DataGrid & DataView & DataGridTableStyle

  • Thread starter Thread starter Rxd
  • Start date Start date
R

Rxd

I have a Datagrid that should have a couple of hidden columns. I used a
DataGridTableStyle to hide the columns and it was working fine except I needed
to prevent the DataGrid from allowing new rows to be added. I was told to use a
DataView and set AddNew to false (thanks for the info btw) but now I can't use
the DataGridTableStyle to hide the columns I don't want. Is there any way to
have both hidden columns and disable AddNew in a DataGrid?

Thanks
 
Rdx,

You could use the click event of the grid. Then, if the currentRowIndex =
datasource.Rows.count call the endInit method of the grid. this should
allow you to use a datatable as a source to allow for table mappings and
stop the user from adding new.

hope this helps

Marco
 
The click event doesn't seem to fire unless you click on a header. It doesn't
fire when you click on any of the grids cells...
 
Rxd,
Correct, you can check for addNew when not clicking on the elipsis(*) but on
a cell of the new Row, by doing the same verification using the
CurrentCellChanged event.

datagrid.currentCell.Rownumber


Marco
 
Back
Top