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
AD
Administrator
Syncfusion Team
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
AD
Administrator
Syncfusion Team
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
AD
Administrator
Syncfusion Team
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
AD
Administrator
Syncfusion Team
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