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.

Assigning Column Names

Thread ID:

Created:

Updated:

Platform:

Replies:

11801 Mar 16,2004 06:06 AM Mar 16,2004 09:57 AM Windows Forms 2
loading
Tags: GridControl
Aaron Jackson
Asked On March 16, 2004 06:06 AM

Is there any way for a GridControl that is not bound to have associated column names. In my case, it would be easier for me if I could refer to columns by name instead of having to track them by index and manage those associations as the users shuffle their locations. Any suggestions.

Administrator [Syncfusion]
Replied On March 16, 2004 09:23 AM

There is no built-in support for named columns in a GridControl. You will have to write some code to handle this. There are some virtual methods in GridModel, like NametoColIndex, that can be used to hook into to supportting named columns. But you still have to implement this virtual method that maps names to colindexes. And if your user shuffles the columns, you have to have some way that that your override is aware of this, and handles things for you. (Ie, you still have to track things somehow). One approach would be to stuff the name in a header cell property (maybe like, model[0, col].Description). Then when your user shuffles the columns, the name geys shuffled also. Then in your NameToColIndex override, you could loop through the header cells to find the description to return the colindex. If you have our source code, you can see this type of behavior implemented for the GridDataBoundGrid in the GridModelDatabinder class which uses teh GridBoundColumns collection to track mappingnames.

Aaron Jackson
Replied On March 16, 2004 09:57 AM

Okay, thats about what I thought. Thanks for the heads up.

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.

;