The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
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;
}
}
ADAdministrator 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);