DataGrid & DataView & DataGridTableStyle

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
 
M

Marco Martin

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
 
R

Rxd

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...
 
M

Marco Martin

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
 

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