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

Insert and Append row in GridGroupingControl

Hi
How can we insert and append the New Row in code behind page using GridGroupingControl.

Kindly provide samples if you have.

Thank you
Kallyani




3 Replies

RS Rajarajeswari S Syncfusion Team June 23, 2008 07:35 PM UTC


Hi,

Thanks for using Syncfusion products.

For inserting or appending a record to the Grid, we have to access the DataSource of the Grid as DataTable and we can add a new row in that, and again we can binded it to the Grid.


Please refer the below code snippet which illustartes this:

DataTable dt = this.GridGroupingControl1.DataSource as DataTable;
DataRow dr5 = dt.NewRow();
dr5[0] = "6";
dr5[1] = " rachel";
dr5[2] = "1";
dt.Rows.Add(dr5);
this.GridGroupingControl1.DataSource = dt;

Please refer the sample from the below link which illustartes this:

http://websamples.syncfusion.com/samples/Grid.Web/6.2.0.40/Grid_Web_AddNewRow/main.htm


Please let me know if you have any other concerns.


Regards,
Raji






KL Kallyani Lanje June 24, 2008 04:35 AM UTC

HI Raji,

Thank you for your response. I am able to add new row using Datatable. but my problem is

we have 2 buttons

1. Insert row button
first we select any of the row in the Grid. then we click the insert button. the empty row will be insert on any of the
grid row position.

2. Append Row button
should be add in the after last row of the grid.


Kindly give some examples.
Thank you,




RS Rajarajeswari S Syncfusion Team June 30, 2008 01:00 PM UTC


Hi Kallyani,


Sorry for the delay in responding you,

You can insert a row in the Grid, if you binded it with ArrayList. Please refer the below code snippet for Inserting and Appending a row in the Grid:

Insertion:

ArrayList arr1 = this.GridGroupingControl1.DataSource as ArrayList;
arr1.Insert(3, new MyClass(007, "Nancy", "UK"));
this.GridGroupingControl1.DataSource = arr1;


Append:

ArrayList arr2 = this.GridGroupingControl1.DataSource as ArrayList;
arr2.Add(new MyClass(008, "Jeorge", "AUS"));
this.GridGroupingControl1.DataSource = arr2;

Please refer the sample from the below link which illustrates this:

http://www.syncfusion.com/support/user/uploads/Insertion_60117936.zip

Please let me know if this helps you out.

Regards,
Raji


Loader.
Live Chat Icon For mobile
Up arrow icon