Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
WinForms DataGrid delete
Message
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
00949754
Message ID:
00950323
Views:
11
>Bind to a DataView and set the AllowDelete property of the dataview to false.

Thanks. I set AllowDelete like this:
((DataView)((CurrencyManager)this.BindingContext[this.dsVendors,"Vendor"]).List).AllowDelete = false;
There seems to be one slight drawback to this approach, if you use it on an mmBusinessForm. If you run the form and select rows in the grid and press the Delete key, nothing is deleted (due to DataView.AllowDelete=false), which is great. However, MM.NET is tricked into thinking that a data edit did take place, because when you close the form (if you use a button with DialogResult=OK), MM.NET prompts "Do you want to save changes?"

Probably best to just use a plain old System.Windows.Forms.DataGrid in this situation (read-only datagrid). Not much benefit in using an mmDataGrid if you're not updating data, I suppose.

Thanks again.
Previous
Reply
Map
View

Click here to load this message in the networking platform