GC: Refer to Column by name rather than index

Hi

In the GridControl, is there a way to refer to a Column by name rather than index? This was a useful feature in the grid control I'm migrating from and meant I didn't have to use "magic numbers" when populating cells.
For example:
I would set a name property (or something similar) on each column in the grid - say "FirstName", "LastName"
Then, when populating the grid I would be able to use something like:
GridControl1(rowIndex, "FirstName").Text = "Richard"
GridControl1(rowIndex, "LastName").Text = "Smith"

Similarly, I would be able to refer to ColStyles using name or index:
GridControl1.ColStyles("FirstName").BackColor = Color.Red

thanks

Richard

3 Replies

HA haneefm Syncfusion Team July 10, 2007 10:06 PM UTC

Hi Richard,

There is no built-in support for this. But you can map column index from its column name in a grid. Below is a forum thread that discuss with similar issue.

http://www.syncfusion.com/support/Forums/message.aspx?&MessageID=61803

Best regards,
Haneef


RB Richard Bysouth July 12, 2007 02:38 AM UTC

Hi

That's ok for getting the alpha name from the index, but not the other way round

GetAlphaLabel(1) would return "A"

I really need GetColIndex("A"). I suppose this isn't available in the GridControl because data is copied into the grid rather than remaining bound to the datasource?


HA haneefm Syncfusion Team July 12, 2007 09:23 PM UTC

Hi Richard,

Here is a forum thread that discuss with similar issue.
http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=11801

Best regards,
Haneef

Loader.
Up arrow icon