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.
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.
RPRekha P Syncfusion Team 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.