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.
Unfortunately, activation email could not send to your email. Please try again.

Custom Caption text based on bound data Property?

Thread ID:

Created:

Updated:

Platform:

Replies:

74919 Jul 3,2008 11:44 AM Feb 28,2018 06:25 AM Windows Forms 4
loading
Tags: GridControl
Curry McKnight
Asked On July 3, 2008 11:44 AM

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.



Sri Rajan [Syncfusion]
Replied On July 8, 2008 06:03 AM

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.


Bill Cowart
Replied On June 24, 2010 10:47 AM


Zenib
Replied On February 27, 2018 06:40 AM

zenib

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

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


CONFIRMATION

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.

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.

;