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

StrongTypedCollection and column captions

Hi,

I''m trying to figure out a way to provide a strong typed collection as a datasource to a GGC, and set column captions to values other than property names. Is it possible to do that with attributes (e.g. [System.ComponentModel.DisplayName("abc")]) or anything else at compile time?

Regards,
Dmitry.

2 Replies

AD Administrator Syncfusion Team September 5, 2006 05:03 AM UTC

Hi Dmitry,

Use the HeaderText property of the GridColumnDescriptor to change the display text of the column header cell. Below is a code snippet.

//For main table.....
//Propertygrid and click TableDescriptor=>Columns[0]=>HeaderText=>"Type the name here"; //through Designer...

this.grid.TableDescriptor.Columns[0].HeaderText = "Column1"; //through Code

//For any table....
GridTableDescriptor gd = this.grid.GetTableDescriptor("MyTable"); //Code
gd.Columns["Col1"].HeaderText = "Column1";

Thanks,
Haneef


DB Dmitry Bakuntsev September 5, 2006 03:48 PM UTC

Thanks, Haneef.

The situation with strong typed collection datasources is slightly more complicated in my case. In fact, I compile those collections at runtime, therefore there''s no "design time" involved with respect to the grid and strong typed collection together.

My question was if there''s anything that can provide the grid with some metadata for a compiled class (similarly to [Browsable(false)] on a property) that can instruct the grid to change column captions.

If that''s not possible (which is a pity, I might add), what''s the best way to traverse a hierarchical GGC and remap column captions (provided that I have the mapping stored somewhere, and I simply need to locate all tables and all columns). The hierarchy normally has two levels.

Off topic, what was the reasoning behind making GGC to support homogeneous hierarchies only? My hierarchy is heterogeneous, and I had a blast yesterday trying to figure out how to hide extra tables.

Regards,
Dmitry.

Loader.
Live Chat Icon For mobile
Up arrow icon