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. Image for the cookie policy date
close icon

Grouping grid - FormatCellText

Hello, I am using the following code in Format Cell Text event handler, to change the text of the cell depending on the column index. This code has a problem if the user moves the columns around and the column index changes. How can I get the column name? I couldn''t find any function in the help. Thanks Shipra public void Scenario_FormatCellText(object sender, GridCellTextEventArgs e) { if(e.Style.CellIdentity.ColIndex == 2) { if(e.Style.Text == "1") { e.Text = "True"; e.Handled = true; } }

1 Reply

AD Administrator Syncfusion Team March 23, 2005 11:34 PM UTC

Try casting the style to a GridTableCellStyleInfo. Then you can access the column name to test for a particular column by name instead of column position. GridTableCellStyleInfo style = e.Style as GridTableCellStyleInfo; Console.WriteLine(style.TableCellIdentity.Column.MappingName);

Loader.
Live Chat Icon For mobile
Up arrow icon