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

Html-like and symbols ">" or "<"

2 Answers 279 Views
GridView
This is a migrated thread and some comments may be shown as answers.
[Nean]
Top achievements
Rank 1
[Nean] asked on 07 Jan 2010, 09:31 AM
Hi everyone,

I face a problem in my project, I have a GridView with Html rendering. I use HTML-like tags in my cells. But the data between the tags is written by users. Sometimes, users wrote in the data symbols like ">" (greater than) and "<" (less than). When they do so, the data behind those symbols and the symbol itself are not displayed. Is there any workaround to display the all comment of the user in that case ?

Thanks,

[Nean]

2 Answers, 1 is accepted

Sort by
0
[Nean]
Top achievements
Rank 1
answered on 08 Jan 2010, 02:29 PM
I have found the solution to the problem, you need to add the "\" character before any "<" or ">" which is not part of a tag. So I use the code following :

string comment; // comment of the user 
string commentForCell = comment.Replace(">", @"\>").Replace("<", @"\<"
 

If this might help spmeone...

[Nean]
0
Peter
Telerik team
answered on 08 Jan 2010, 04:50 PM
Hello [Nean],

Thank you for writing.

The more preferred way is to escape these symbols using &gt; for >  and &lt; for <.

I hope this helps.

Please note that we are still expecting an answer from you in ticket (233128) Order of AutoHide DockPanel.

Best wishes,
Peter
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
GridView
Asked by
[Nean]
Top achievements
Rank 1
Answers by
[Nean]
Top achievements
Rank 1
Peter
Telerik team
Share this question
or