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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How do I hide columns in a GGC but still be able to access their data?

Thread ID:

Created:

Updated:

Platform:

Replies:

57027 Feb 23,2007 09:31 PM UTC Feb 27,2007 08:20 PM UTC WinForms 4
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On February 23, 2007 09:31 PM UTC

Hi,
I have some columns I don't want to show in ggc that I populate from datatables/dataviews. I want to show only selected columns at runtime (for example, an ID column) but I still want to be able to refer to that ID value in code.
Suggestions?

Thanks,
Dimitri

Administrator [Syncfusion]
Replied On February 23, 2007 11:10 PM UTC

Hi Dimitri,

Thank you for being patience.

This can be achieved by adding the required columns in the VisibleColumnsCollection. This can be achieved both in designer mode and code.

By Code
>>>>>>
this.gridGroupingControl1.TableDescriptor.VisibleColumns.AddRange(new Syncfusion.Windows.Forms.Grid.Grouping.GridVisibleColumnDescriptor[] {
new Syncfusion.Windows.Forms.Grid.Grouping.GridVisibleColumnDescriptor("ID"),
new Syncfusion.Windows.Forms.Grid.Grouping.GridVisibleColumnDescriptor("BirthDate")});
>>>>>>

By Designer Mode
>>>>>
Please refer to the TableDescriptor -> VisibleColumns in the properties window. You can add the required columns have to be visible.
>>>>>

Have a nice day.

Best regards,
Madhan

Administrator [Syncfusion]
Replied On February 26, 2007 06:11 PM UTC

Hi Madhan,
This doesn't seem to work. The unwanted columns are still there, as well as the wanted ones. Does it matter if I load the GCC from XML and not name the columns explicitly in the designer?

Thanks,
Dimitri


>Hi Dimitri,

Thank you for being patience.

This can be achieved by adding the required columns in the VisibleColumnsCollection. This can be achieved both in designer mode and code.

By Code
>>>>>>
this.gridGroupingControl1.TableDescriptor.VisibleColumns.AddRange(new Syncfusion.Windows.Forms.Grid.Grouping.GridVisibleColumnDescriptor[] {
new Syncfusion.Windows.Forms.Grid.Grouping.GridVisibleColumnDescriptor("ID"),
new Syncfusion.Windows.Forms.Grid.Grouping.GridVisibleColumnDescriptor("BirthDate")});
>>>>>>

By Designer Mode
>>>>>
Please refer to the TableDescriptor -> VisibleColumns in the properties window. You can add the required columns have to be visible.
>>>>>

Have a nice day.

Best regards,
Madhan

Administrator [Syncfusion]
Replied On February 27, 2007 12:12 AM UTC

Hi Dimitri,

Before adding the required columns to the VisibleColumns collection, try calling the Clear method to clear all the visible columns in a grid. Here is a code snippet.

//Form's Load event.
this.gridGroupingControl1.TableDescriptor.VisibleColumns.Clear();

this.gridGroupingControl1.TableDescriptor.VisibleColumns.AddRange(new Syncfusion.Windows.Forms.Grid.Grouping.GridVisibleColumnDescriptor[] {
new Syncfusion.Windows.Forms.Grid.Grouping.GridVisibleColumnDescriptor("ID"),
new Syncfusion.Windows.Forms.Grid.Grouping.GridVisibleColumnDescriptor("BirthDate")});

Best regards,
Haneef

Administrator [Syncfusion]
Replied On February 27, 2007 08:20 PM UTC

Hi Haneef,
Okay, I'm able to hide columns using:

this.myGGC.TableDescriptor.Columns.Clear();

then add them:

this.myGGC.TableDescriptor.Columns.Add(new GridColumnDescriptor("col1", "col1", "col1"));

BUT, now I don't get the data that I was getting before using this:

this.txtType.Text = this.myGGC.Table.GetTableCellStyle(rec, "col1").Text;

If I put all the columns back, then I can again get the data in my selected rows. This is so strange.

Thanks,
Dimitri







>Hi Dimitri,

Before adding the required columns to the VisibleColumns collection, try calling the Clear method to clear all the visible columns in a grid. Here is a code snippet.

//Form's Load event.
this.gridGroupingControl1.TableDescriptor.VisibleColumns.Clear();

this.gridGroupingControl1.TableDescriptor.VisibleColumns.AddRange(new Syncfusion.Windows.Forms.Grid.Grouping.GridVisibleColumnDescriptor[] {
new Syncfusion.Windows.Forms.Grid.Grouping.GridVisibleColumnDescriptor("ID"),
new Syncfusion.Windows.Forms.Grid.Grouping.GridVisibleColumnDescriptor("BirthDate")});

Best regards,
Haneef

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.

Warning Icon 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.Close Icon

;