GridGroupingControl Column - HtmlEncode

Hi,
In GridGroupingControl, Is there any column properties for display the data in HtmlEncode format?.

Example in Gridview:


Thank you







1 Reply

RS Rajarajeswari S Syncfusion Team July 25, 2008 12:21 PM UTC


Hi Kallyani,

Thanks for using Syncfusion products.

In our GridGroupingControl an event called, “QueryCellStyleInfo” which will get raised, for each and every cell gets rendered. There we can make change the style attribute of each and every cell, including the CellValue.

Please refer the below code snippet where “HtmlEncode” is applied for a certain column.

protected void GridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
if (e.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell || e.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell )
{
if (e.TableCellIdentity.Column.Name == "String")
{
string text = e.Style.CellValue.ToString();
e.Style.CellValue = Server.HtmlEncode(text);
}
}

}


Please refer the sample from the belwo link which illusatrtes this:

http://www.syncfusion.com/support/user/uploads/HtmlEncode_c7e05679.zip

Please have a look at the above and let me know if you have any other concerns.

Regards,
Raji



Loader.
Up arrow icon