I have a data grid view ( say 5 columns ) . User has the option to disable/enable 1 particular column of the data table (using radio buttons). So How should I go about doing it?
When I select to disable the column, I need to make it non editable, change the color of the column so that user can understand that the column is disabled and any other suggestion are also welcome.
To hide a column programmaticallySet the DataGridViewColumn. Visible property to false .
Set the IsReadOnly property to true to make all the cells in the DataGrid read-only. To make individual columns or cells read-only, set the DataGridColumn. IsReadOnly or DataGridCell. IsReadOnly properties.
Disabling Column Sorting | ComponentOne DataGrid for WPF and Silverlight. By default end users can sort columns in the grid at run time. For more information, see Sorting Columns. If you choose, however, you can disable the column sorting feature by setting the CanUserSort property to False.
The DataGrid control is limited to displaying data from an external data source. The DataGridView control, however, can display unbound data stored in the control, data from a bound data source, or bound and unbound data together.
Set the column's ReadOnly property to true to make it non-editable. And alter its DefaultCellStyle.BackColor (and/or ForeColor) to make it obvious to the user.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With