We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Show and Hide columns in a grid databound grid

Thread ID:

Created:

Updated:

Platform:

Replies:

69376 Oct 25,2007 01:34 PM Oct 31,2007 08:09 PM Windows Forms 4
loading
Tags: GridControl
Charlie
Asked On October 25, 2007 01:34 PM

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

J.Nagarajan [Syncfusion]
Replied On October 25, 2007 04:32 PM

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

Charlie
Replied On October 30, 2007 11:28 AM

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


Charlie
Replied On October 31, 2007 10:00 AM

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


J.Nagarajan [Syncfusion]
Replied On October 31, 2007 08:09 PM

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


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;