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

Call a custom function to transform cell contents

Thread ID:





84195 Jun 29,2009 09:11 PM UTC Jul 6,2009 07:46 AM UTC WinForms 1
Tags: GridControl
Vasili Sviridov
Asked On June 29, 2009 09:11 PM UTC

I've looked at the sample code for the "Conditional Formatting" and "Column Formatting" but I'd like to go beyond that. For instance I want to prefix or post-fix the text with custom strings base on the content.

Currently I do it using the Custom class, that derives from ITemplate, but it's quite cumbersome and also the end result does not affect grouping, as the original data is used for grouping and sorting purposes.

Hopefully there's an easier way to do what I want. Any suggestions are appreciated.

Rekha P [Syncfusion]
Replied On July 6, 2009 07:46 AM UTC

Hi Vasili,

Thank you for your interest in Syncfusion Products.

You can customize the Grid cell text when Data is bound to a Row through RowDataBound event handler. Please refer a simple code snippet below to achieve this.

void GridGroupingControl1_RowDataBound(object sender, RowDataBoundEventArgs e)
////// Gets the Current Record Row Element Bound.
if (e.Element.Kind == DisplayElementKind.Record)
for (int i = 0; i < e.Row.Cells.Count; i++)
/////// Check for column name.
if (((Syncfusion.Web.UI.WebControls.Grid.Grouping.GridCell)(e.Row.Cells[i])).ColumnDescriptor.Name == "Name")
e.Row.Cells[i].Text = "AA " + e.Row.Cells[i].Text + " BB";

The steps followed here are,
- Get the RowDataBound event.
- Check if that Row is Grid Record row, if so Iterate the Grid cells .
- Check for column name and modify the GridCell value.



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

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