I'm using devexpress gridcontrol, and I want to generate 10 rows automatically on Click, I have researched some sources and says that it doesn't have a property like the standard GridView to add rows like gridView.Rows.Add();
0
votes
1 Answers
0
votes
To be able to add rows in your grid :
. Your gridDataSource property should be set
. Make your view editable
gridView1.OptionsBehavior.Editable = true;
gridView1.OptionsView.NewItemRowPosition = NewItemRowPosition.Bottom;
for (int i = 1; i < 10; i++)
{
gridView1.AddNewRow();
}
. Set the position of the NewItemRowPosition of your view
gridView1.OptionsView.NewItemRowPosition = NewItemRowPosition.Bottom;
if you use the datatable as source you can write :
DataTable tabe = new DataTable();
gridControl1.DataSource = table;
DataRow newLigne = table.NewRow();
table.Rows.Add(newLigne);