Does any body know how to prevent a user from deleting rows from a datagrid?
Printable View
Does any body know how to prevent a user from deleting rows from a datagrid?
set the 'ReadOnly' property to True.
but this will also restrict the user to add any new records.
i know about the readonly property.
i want a situation whereby if rows are selected, and delete button on the keyboard pressed, the rows will not be deleted.
Then, on the KeyDown event of ur grid, check if the row is selected and if Del. key is pressed. If so, then set the e.Cancel to True.
Hope it helps
or make a datagridtablestyle and set the textbox.enable = false..