We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How to insert new blank row in gridgrouping control?

Hi,
I want to insert new blank row after multiple records are deleted from grid grouping control,
I am using ,
this.gridGroupingControl1.TopLevelGroupOptions.ShowAddNewRecordAfterDetails = true;
after Delete() but it doesn't work.
When I click on row it gives "Object reference not set to an instance of an object".
Is any solution regarding this?


Regards,
Paurnima.

3 Replies

MK Muthukumar Kalyanasundaram Syncfusion Team November 13, 2014 06:46 PM UTC

Hi Paurnima,

 

Thank you for your interest in Syncfusion products.

 

If you want to insert a new blank row after multiple records are deleted in gridgroupingcontrol, you can enabled the “AllowNew” property as true. Please refer the below code,

 

Code:

 

private void buttonAdv1_Click(object sender, EventArgs e)

   {

     foreach (var tbl in this.gridGroupingControl1.Table.SelectedRecords)   // delete multiple record

      {

         tbl.Record.Delete();

      }

       this.gridGroupingControl1.TableDescriptor.AllowNew = true;           

   }

 

Please let us know if you have any concern.

 

Regards,

Muthukumar K



PA Paurnima November 15, 2014 09:14 AM UTC

Hello,
I tried the code but it can't help.
I am trying to delete multiple records at a time from grid grouping control using
  this.gridgroupingcontrol.TableModel.Options.SelectCellsMouseButtonsMask = MouseButtons.Left;
  this.gridgroupingcontrol.TableOptions.ListBoxSelectionMode = SelectionMode.MultiExtended;
  this.gridgroupingcontrol.TableOptions.AllowSelection = GridSelectionFlags.None;
And then want to insert new row in gridgroupingcontrol but it gives me object reference error.
Please give me any solution.
Regards,
Paurnima.



MK Muthukumar Kalyanasundaram Syncfusion Team November 17, 2014 10:33 AM UTC

Hi Paurnima,

 

If you want to insert new blank row in the bottom section of the group, you can set the “ShowAddNewRecordAfterDetails” property  to true. Please refer the below code,

 

Code:

 

Suggestion 1 :

 

private void buttonAdv1_Click(object sender, EventArgs e)

        {

            foreach (var tbl in this.gridGroupingControl1.Table.SelectedRecords)

            {

                tbl.Record.Delete();

             

            }

               this.gridGroupingControl1.TopLevelGroupOptions.ShowAddNewRecordAfterDetails = true;

               this.gridGroupingControl1.TableDescriptor.AllowNew = true;

               this.gridGroupingControl1.TopLevelGroupOptions.ShowAddNewRecordBeforeDetails = false; 

        }

 

Please let us know if you have any concern.

 

Regards,

Muthukumar K


Attachment: MultirecordSelection_Delect_f92aec20.zip

Loader.
Up arrow icon