This is a migrated thread and some comments may be shown as answers.

Displaying HTML tags as text

1 Answer 104 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Alan Yu
Top achievements
Rank 1
Alan Yu asked on 08 Jul 2008, 06:23 PM
Hi,

Is there a setting in the grid that would have it display HTML tags as text instead of rendering them?

Thanks

1 Answer, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 09 Jul 2008, 07:19 AM
Hello Alan

You can use Server.HTMLEncode Method to achieve this. Here is an example for GridTemplateColumn:

<telerik:GridTemplateColumn HeaderText="MyCol">
<ItemTemplate>
<%# Server.HtmlEncode(Eval("MyColumn").ToString())%>
</ItemTemplate>
</telerik:GridTemplateColumn>

You can use also ItemCreated/ItemDataBound to achieve the same with auto-generated GridBoundColumns.

Greetings,
Vlad
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Grid
Asked by
Alan Yu
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Share this question
or