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. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Assigning Column Names

Thread ID:





11801 Mar 16,2004 11:06 AM UTC Mar 16,2004 02:57 PM UTC WinForms 2
Tags: GridControl
Aaron Jackson
Asked On March 16, 2004 11:06 AM UTC

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 02:23 PM UTC

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 02:57 PM UTC

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


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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

Live Chat Icon For mobile
Live Chat Icon