DataGrid columns..

wyrd

Well-known member
Joined
Aug 23, 2002
Messages
1,408
Location
California
In a DataView you can easily set a column as read only, but I was wondering if there was a way in the DataGrid to set a columns enabled to false. Read only still allows them to edit it, and just changes the value back after they click outside the column. Im looking for a way so they cant edit whats in side at all (no changing!) or even click inside the column.

Better yet, is there a way to filter columns displayed with the DataView? I know theres RowFilter, but nothing that seems to cover column filtering.
 
If you mean to hide columns (your second question), you have to define a new DataGridTableStyle. Check the help for more info. I believe you can also make columns non-editable this way but Im not sure if theres an easier way.

-nerseus
 
Aha! So thats where it was hiding. Interesting. :cool: And very nice. :) Thanks.

In the future .NET should add column support to the DataView class so I can easily filter them out using that instead. They designed it to filter rows, why not columns too? And just because you can do it with a DataGrid is not the point! :rolleyes:

*ponder* Come to think of it, when I become an all mighty guru maybe Ill extend the DataView class so you can do just that. ;)
 
Back
Top