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.
ADAdministrator Syncfusion Team 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.
AJAaron JacksonMarch 16, 2004 09:57 AM
Okay, thats about what I thought. Thanks for the heads up.