I have datagrid and button on web form . I want to add row on each button
Click by using datatable, how should i do this . by insertat or ,rowadd Method??
Printable View
I have datagrid and button on web form . I want to add row on each button
Click by using datatable, how should i do this . by insertat or ,rowadd Method??
I guess you'll be using one of the "System.Windows.Forms.DataGridView.Rows.Add();" overloads unless you want to specify the row index then use the System.Windows.Forms.DataGridView.Rows.Insert();
@ComputerJy, what ERUM is asking for is web control related and hence Rows.Insert() 0r Rows.Add() won't work. Moreover, DatagridView is for windows forms.
Sorry, I must have miss-read this the first time.Quote:
Originally Posted by rjv_rnjn
Anyways, the InsertAt method is used when you want to specify the row index
Create a datarow object. Set it to be the datatable's newrow method's return value. Once you have it, populate it with 'blank' values, then add it to the datatable. Then rebind your gridview to the datatable.