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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Custom Caption text based on bound data Property?

Thread ID:





74919 Jul 3,2008 03:44 PM UTC Feb 28,2018 11:25 AM UTC WinForms 4
Tags: GridControl
Curry McKnight
Asked On July 3, 2008 03:44 PM UTC


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.

Sri Rajan [Syncfusion]
Replied On 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.

Please try this and let me know if this helps.

Best Regards,

Bill Cowart
Replied On June 24, 2010 02:47 PM UTC

Replied On February 27, 2018 11:40 AM UTC


Arulpriya Ramalingam [Syncfusion]
Replied On February 28, 2018 11:25 AM UTC

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


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

or the page will be automatically redirected to 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