how to avoid user to add a new row in the datagrid control?

  • Thread starter Thread starter Cyrus
  • Start date Start date
I only want the datagrid show 4 and only 4 rows.

Set the DataSource of the grid to a DataView, and set the
AllowNew property of the DataView to false.

DataView vw = new DataView(SomeDataSet.SomeTable);
vw.AllowNew = false;
MyDataGrid.DataSource = vw;
 
How about if i use dataset?

David said:
Set the DataSource of the grid to a DataView, and set the
AllowNew property of the DataView to false.

DataView vw = new DataView(SomeDataSet.SomeTable);
vw.AllowNew = false;
MyDataGrid.DataSource = vw;
 
Back
Top