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 : November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

VisibleColumn index and Column index

Thread ID:

Created:

Updated:

Platform:

Replies:

68405 Sep 20,2007 11:45 AM UTC Sep 20,2007 11:11 PM UTC WinForms 2
loading
Tags: GridControl
Franz Gsell
Asked On September 20, 2007 11:45 AM UTC

Hi,

I have a GGC which is bound to a business object via complex databinding. In some special cases it is necessary to hide some columns. I found out that this can be done via the TableDescriptor.VisibleColumns.Remove(..) or .Add(..) method.

Now I am wonder what happens to the column indizies in this case. So for example when I use the TableControlCellClick event, one EventArg property is the column index. Now when i want to get the corresponding column (which was clicked) then usually I do something like this:

int fieldIndex = gridGroupingControl1.TableDescriptor.ColIndexToField(e.Inner.ColIndex);
string name = gridGroupingControl1.TableDescriptor.Columns[fieldIndex].Name;

But this doesn't work when I set the VisibleCoumns property of the TableDescriptor. Then I have to replace the two lines above with:

int fieldIndex = gridGroupingControl1.TableDescriptor.ColIndexToField(e.Inner.ColIndex);
string name = gridGroupingControl1.TableDescriptor.VisibleColumns[fieldIndex].Name;

So how do I know if I should use the .VisibleColumns or the .Columns - Is there a way to get always the right column without knowing if one should use VisibleColumn or Column?

And how can I get the GridColumnDescriptor of a GridVisibleColumnDescriptor?

Cheers,
Franz


Franz Gsell
Replied On September 20, 2007 11:50 AM UTC

Just a try: would it be correct to do something like this:

int fieldIndex = tableControl.TableDescriptor.ColIndexToField(this.ColIndex);
GridVisibleColumnDescriptor visibleDescriptor = tableControl.TableDescriptor.VisibleColumns[fieldIndex];
GridColumnDescriptor colDescriptor = tableControl.TableDescriptor.Columns[visibleDescriptor.Name];

to get the corresponding GridColumnDescriptor?

The handling of the column indizies is a little bit confusing.

J.Nagarajan [Syncfusion]
Replied On September 20, 2007 11:11 PM UTC

Hi Franz,

The GridColumnDescriptor provides the mapping information to a column of the underlying datasource. All the columns from the datasource are managed by the GridColumnDescriptorCollection that is returned by the GridTableDescriptor. Whereas, the GridVisibleColumnDescriptor refrences the GridColumnDescriptor, but this defines the order of columns shown in the grid from left to right.

What you have tried in earlier update is fine. You can go ahead with this.

Please let me know if you need more information.

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.

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

;