Deleting multiple data entries from a Form
By default, you are only able to delete a Form's entries one by one. This article describes how to add a simple delete button to the editing interface to delete selected items at once.
The changes will be made to the administration interface in CMSDesk -> Tools -> Forms -> <edit a form> -> Data.
You need to make changes to three files.
The first file to modify is \CMSModules\Bizforms\Tools\BizForm_Edit_Data.aspx.
You can add a delete button within the <asp:Content > tags:
<asp:Button Text="Delete" id="btnDelete" runat="server" OnClick="Delete_Click" />
The second file is the code behind \CMSModules\Bizforms\Tools\BizForm_Edit_Data.aspx.cs
. Copy and paste the code below into this file:
protected void Delete_Click(object sender, EventArgs e)
DataView dv = (DataView)this.gridData.GridView.DataSource;
int count = 1;
string formid = "0";
if (Request.QueryString["formid"] != null)
formid = Request.QueryString["formid"];
CMS.FormEngine.BizFormInfo bfi = CMS.FormEngine.BizFormInfoProvider.GetBizFormInfo(System.Convert.ToInt32(formid));
foreach (DataRow item in dv.Table.Rows)
int entryID = System.Convert.ToInt32(item);
CMS.FormEngine.BizFormItem bfii = new BizFormItem(item, CMS.SettingsProvider.DataClassInfoProvider.GetClassName(bfi.FormClassID)); bfii.Delete();
The last file to modify is the file \CMSModules\Bizforms\Tools\BizForm_Edit_Data.xml
. There you have to add the key below:
<key name="ShowSelection" value="true" />
Please note, that this is only an example and it is not fully tested for all scenarios.
See also: UniGrid configurationApplies to:
Kentico CMS 6.0