Show and Hide columns in a grid databound grid
Hi,
Can someone help me with show and hiding certain columns in my data grid. I have a grid that has around 19 columns. Is it possible to maybe have a checkbox that corressponds to each column and if you check it, it shows only those columns checked. Any help would be appreciated. Please let me know if there is a sample that already exist that does this.
Thanks!
Charlie
Can someone help me with show and hiding certain columns in my data grid. I have a grid that has around 19 columns. Is it possible to maybe have a checkbox that corressponds to each column and if you check it, it shows only those columns checked. Any help would be appreciated. Please let me know if there is a sample that already exist that does this.
Thanks!
Charlie
SIGN IN To post a reply.
4 Replies
J.
J.Nagarajan
Syncfusion Team
October 25, 2007 08:32 PM UTC
Hi Charlie ,
Thanks for your continued interest in Syncfusion products.
You can use Model.HideCols[2] property of gridDataBoundGrid to show or hide the grid columns. Please refer to the following code snippet
//To hide Columns
this.gridDataBoundGrid1.Model.HideCols[2] =true;
//To show Columns
this.gridDataBoundGrid1.Model.HideCols[2] =false;
I have attached the sample for your reference. You can download the sample from the following page.
http://websamples.syncfusion.com/samples/Grid.Windows/F69376/main.htm
Please refer to the sample and let me know if this helps.
Regards,
Nagaraj
Thanks for your continued interest in Syncfusion products.
You can use Model.HideCols[2] property of gridDataBoundGrid to show or hide the grid columns. Please refer to the following code snippet
//To hide Columns
this.gridDataBoundGrid1.Model.HideCols[2] =true;
//To show Columns
this.gridDataBoundGrid1.Model.HideCols[2] =false;
I have attached the sample for your reference. You can download the sample from the following page.
http://websamples.syncfusion.com/samples/Grid.Windows/F69376/main.htm
Please refer to the sample and let me know if this helps.
Regards,
Nagaraj
CH
Charlie
October 30, 2007 03:28 PM UTC
Thanks for the response. This example is great. Also, is there a way for syncfusion to save the changes once a user hides a column. For example, if a user hides a column and then exits the program, can syncfusion remember those changes so that the user doesnt have to hide the columns again.
Thanks,
Charlie
>Hi Charlie ,
Thanks for your continued interest in Syncfusion products.
You can use Model.HideCols[2] property of gridDataBoundGrid to show or hide the grid columns. Please refer to the following code snippet
//To hide Columns
this.gridDataBoundGrid1.Model.HideCols[2] =true;
//To show Columns
this.gridDataBoundGrid1.Model.HideCols[2] =false;
I have attached the sample for your reference. You can download the sample from the following page.
http://websamples.syncfusion.com/samples/Grid.Windows/F69376/main.htm
Please refer to the sample and let me know if this helps.
Regards,
Nagaraj
Thanks,
Charlie
>Hi Charlie ,
Thanks for your continued interest in Syncfusion products.
You can use Model.HideCols[2] property of gridDataBoundGrid to show or hide the grid columns. Please refer to the following code snippet
//To hide Columns
this.gridDataBoundGrid1.Model.HideCols[2] =true;
//To show Columns
this.gridDataBoundGrid1.Model.HideCols[2] =false;
I have attached the sample for your reference. You can download the sample from the following page.
http://websamples.syncfusion.com/samples/Grid.Windows/F69376/main.htm
Please refer to the sample and let me know if this helps.
Regards,
Nagaraj
CH
Charlie
October 31, 2007 02:00 PM UTC
Thanks for the response. This example is great. Also, is there a way for syncfusion to save the changes once a user hides a column. For example, if a user hides a column and then exits the program, can syncfusion remember those changes so that the user doesnt have to hide the columns again.
Thanks,
Charlie
Thanks,
Charlie
J.
J.Nagarajan
Syncfusion Team
November 1, 2007 12:09 AM UTC
Hi Charlie ,
If you hide/show columns by removing or inserting them in the GridBoundColumns collections, then serializing that collection should be enough. But if you are using something else to hide/show columns, then you would have to serialize that collections as well. One simple thing might be to create a bool[dataTable.Columns.Count] object that holds whether the column is visible or not, and then serialize this array in addition the other information.
Please let me know if you have any other questions.
Regards,
Nagaraj
If you hide/show columns by removing or inserting them in the GridBoundColumns collections, then serializing that collection should be enough. But if you are using something else to hide/show columns, then you would have to serialize that collections as well. One simple thing might be to create a bool[dataTable.Columns.Count] object that holds whether the column is visible or not, and then serialize this array in addition the other information.
Please let me know if you have any other questions.
Regards,
Nagaraj
SIGN IN To post a reply.
- 4 Replies
- 3 Participants
-
CH Charlie
- Oct 25, 2007 05:34 PM UTC
- Nov 1, 2007 12:09 AM UTC