Alec Cohen

Alec Cohen

  • NA
  • 5
  • 0

How can I stop users adding new rows to a datagrid

Dec 13 2005 5:05 PM
I have a database application, part of which requires multiple inserts (up to 50 records) from a single form. I have considered using a datagrid to allow the user to update the database. The datagrid has 6 columns, 4 of which are prepopulated from a look up table in the database.
The datagrid is bound to a datatable which has two columns of null values. It is these columns which the user needs to edit. So far so good. Except I cannot find a way to stop the user adding rows to the end of the datagrid. Setting ColumnStyles to read only is only effective post creation of a new row.
I would br grateful for some pointers as to how I can stop users adding new datagrid rows or alternatively how I could limit the number of rows in a datagrid. (I am using VS 2003 C'#)
Many Thanks in advance

Answers (2)