DataGrid: Way to show hide columns ?

  • Thread starter Thread starter Jeff M
  • Start date Start date
J

Jeff M

Is there any way to not show an column in a datagrid
instead of removing the row in the dataset ?

_myds = customerRequestsLite.Fill("*");

RemoveColumns(_myds.Tables["CustomerRequest"],"Location");

RemoveColumns(_myds.Tables["CustomerRequest"],"Customer");

RemoveColumns(_myds.Tables["CustomerRequest"],"TimeCreated")
 
Actually, set it to -1. If you set it to 0, it leaves the borders visible
which looks untidy.

Alex Feinman said:
Set the column width to 0 ?

Jeff M said:
Is there any way to not show an column in a datagrid
instead of removing the row in the dataset ?

_myds = customerRequestsLite.Fill("*");

RemoveColumns(_myds.Tables["CustomerRequest"],"Location");

RemoveColumns(_myds.Tables["CustomerRequest"],"Customer");

RemoveColumns(_myds.Tables["CustomerRequest"],"TimeCreated")
 
You can set up a custom GridStyle which defines which columns to show and a
small amount of formatting (basically with .NETCF you are limited to column
widths, null text and the column header). There is a sample here:-
http://www.inthehand.com/forums/viewtopic.php?t=96

To not show a column, simply don't include it in your GridStyle definition -
it will still be present in the underlying data table.

Peter

--
Peter Foot
Windows Embedded MVP

In The Hand
http://www.inthehand.com
 
Ok this sounds well thought out.

I will give this a shot.

Thanks Everyone !


Peter Foot said:
You can set up a custom GridStyle which defines which columns to show and a
small amount of formatting (basically with .NETCF you are limited to column
widths, null text and the column header). There is a sample here:-
http://www.inthehand.com/forums/viewtopic.php?t=96

To not show a column, simply don't include it in your GridStyle definition -
it will still be present in the underlying data table.

Peter

--
Peter Foot
Windows Embedded MVP

In The Hand
http://www.inthehand.com

Jeff M said:
Is there any way to not show an column in a datagrid
instead of removing the row in the dataset ?

_myds = customerRequestsLite.Fill("*");

RemoveColumns(_myds.Tables["CustomerRequest"],"Location");

RemoveColumns(_myds.Tables["CustomerRequest"],"Customer");

RemoveColumns(_myds.Tables["CustomerRequest"],"TimeCreated")
 
Back
Top