DataGrid - Not allowing additions?

  • Thread starter Thread starter Chris Ashley
  • Start date Start date
C

Chris Ashley

Is there any way to stop users from being able to add new rows to my
datagrid while still letting them edit existing rows?
 
Hi Chris,

Set the value of the AllowNew property of the dataview to false.

If you are binding this datagrid to a datatable directly (maybe in design
view), then you will have to fetch the datatable's defaultview and then set
this property. The code would be something like this:
((DataView)((CurrencyManager)BindingContext[datatable
name]).List).AllowNew = false;

HTH,
- Rakesh

HTH,
Rakesh Rajan
 
Back
Top