Custom Caption text based on bound data Property?

Greetings.

I have read through a number of posts on this forum looking for help on what I need to do and have not found exactlt the information I'm looking for. What I'm trying to do is set a group's caption text based on the data that was used to populate the group. It seems the recommended way to override caption text with your own is to handle the QueryCellStyleInfo event, and change e.Style.Text to whatever you need. That's fine, but what I need to know is how I am supposed to get some identifying information about the group for whose caption I'm changing.

Right now I'm checking e.TableCellIdentity.TableCellType to see if it is a GridTableCellType.GroupCaptionCell. Once I've done that, I need to get to the data source used for that group (my data sources are custom object bindings to classes in my code). I've done this successfully in other places, such as when iterating SelectedRecords, by casting the return object from Record.GetData() to an object of the class used as its data source. But all my calls to GetData() from within QueryCellStyleInfo handler return null.

Here are some example classes to help illustrate what I'm trying to do. C# code is given and assume all classes own any members used in methods that aren't specifically listed.

Class Foo
{
public int SomeProperty { get { return 1; } }
}

Class Bar
{
public string MyDescription { get { return "This is what I need access to"; } }
public List MyItems { get { return mFooList; } }
}

So my Grid Grouping Control uses an object binding to Bar objects as its data source. That table has a relation table that uses Foo object binding. So the table is organized into groups of Bar with rows of Foo. My QueryCellStyleInfo handler wants to override the caption for each group with the value of Bar.MyDescription.

Hopefully this makes sense and please let me know if you need clarification or more information from me.

Thank you.



4 Replies

SR Sri Rajan Syncfusion Team July 8, 2008 10:03 AM UTC

Hi Curry,

Thank you for your interest in Syncfusion products.

Here is the minimal sample which implements your requirement.
http://websamples.syncfusion.com/samples/grid.windows/F74919/main.htm

Please try this and let me know if this helps.

Best Regards,
Srirajan.



BC Bill Cowart June 24, 2010 02:47 PM UTC



ZE Zenib February 27, 2018 11:40 AM UTC

zenib


AR Arulpriya Ramalingam Syncfusion Team February 28, 2018 11:25 AM UTC

Hi Zenib, 
 
Please let us know, whether you need further assistance on this. 
 
Regards, 
Arulpriya 


Loader.
Up arrow icon