DataGrid - Not allowing additions?

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?
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top