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

How to retrieve the text that is set in the TableControlDrawCellDisplayText event of the GroupingGrid?

Platform: WinForms |
Control: GridGroupingControl |
Published Date: April 30, 2011 |
Last Revised Date: February 12, 2016

Problem

There is no direct way to retrieve the text that is set for any cell in the TableControlDrawCellDisplayText event because the GridStyleInfo object associated with the cell does not hold any information.

 

Solution

The text can be retrieved by having a hashtable with record and the column names as the hashcode key. In the following code example, a unique key for each cell is generated because the row index might be changed due to other functions. For example, Sorting. The GetKey method is used to convert the record and column names to hashcode key.

C#

VB

A column QtyPerUnit is customized by the TableControlDrawCellDisplayText event to format the cell value to Kilograms. For example, 1000 is changed to 1 Kg. These customized texts are stored into the hashtable based on its hashcode key.

C#

VB

Finally, the value of the selected records is retrieved and the customized text is recovered through the hashtable ht[GetKey(record, "QtyPerUnit")]. These changes are handled in the buttonClick event.

C#

VB

 

After applying the properties, the Grid looks like the following screenshot.

 

Sample Links

CS: Retrieving_DisplayText

VB: Retrieving_DisplayText

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

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