Hi,
I using some ampersand characters in my treeview, but when I validate my page with http://validator.w3.org I get some error on the ambersand characters.
Line 146, Column 132: StartTag: invalid element name
Is it possible to make the treeview control to show ambersand?
Best regards
Aksel Henriksen
I using some ampersand characters in my treeview, but when I validate my page with http://validator.w3.org I get some error on the ambersand characters.
Line 146, Column 132: StartTag: invalid element name
…x?Category=$VingepumpeMindre250&menyCategory=1,1">Vingepumper, <250 bar</a>
<
telerik:RadTreeNode
Text
=
"Vingepumper, <250 bar"
NavigateUrl
=
"~/preview.aspx?Category=$VingepumpeMindre250&menyCategory=1,1"
></
telerik:RadTreeNode
>
Is it possible to make the treeview control to show ambersand?
Best regards
Aksel Henriksen
4 Answers, 1 is accepted
0
Kevin
Top achievements
Rank 2
answered on 05 Oct 2011, 01:18 PM
Hello Spire,
It appears the RadTreeView doesn't html encode the Text property, but somehow does the opposite, it html decodes it. So if you enter it like you did or just enter "<", it will always render it as "<" to the browser.
Maybe this is a bug with the RadTreeView or maybe there is a reason it does it this way.
It appears the RadTreeView doesn't html encode the Text property, but somehow does the opposite, it html decodes it. So if you enter it like you did or just enter "<", it will always render it as "<" to the browser.
Maybe this is a bug with the RadTreeView or maybe there is a reason it does it this way.
0
Hello Kevin,
Nikolay Tsenkov
the Telerik team
Actually RadTreeView encodes the Text property when rendering it. But getting the value from the text property should return the initially inserted.
Nikolay Tsenkov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Accepted
Kevin
Top achievements
Rank 2
answered on 07 Oct 2011, 01:09 PM
Hello Nikolay,
I don't see any html encoding of any kind going on with the RadTreeView control. It seems to html decode the Text property when you add it in the designer and just takes that text as is when you add it from the code-behind. Try this and tell me what the html source is:
Designer:
Code-Behind:
The one's in the designer both show as 1 < 2 in the html source, the one's added from the code-behind get added as is. Do you not get the same effect?
I'm using version 2011.2.712.35 of the controls.
I don't see any html encoding of any kind going on with the RadTreeView control. It seems to html decode the Text property when you add it in the designer and just takes that text as is when you add it from the code-behind. Try this and tell me what the html source is:
Designer:
<
telerik:RadTreeView
ID
=
"RadTreeView1"
runat
=
"server"
>
<
Nodes
>
<
telerik:RadTreeNode
Text
=
"1 < 2"
>
</
telerik:RadTreeNode
>
<
telerik:RadTreeNode
Text
=
"1 < 2"
>
</
telerik:RadTreeNode
>
</
Nodes
>
</
telerik:RadTreeView
>
Code-Behind:
RadTreeView1.Nodes.Add(
new
RadTreeNode(
"2 < 3"
));
RadTreeView1.Nodes.Add(
new
RadTreeNode(
"2 < 3"
));
The one's in the designer both show as 1 < 2 in the html source, the one's added from the code-behind get added as is. Do you not get the same effect?
I'm using version 2011.2.712.35 of the controls.
0
Accepted
Hello Kevin,
Regards, Nikolay Tsenkov
the Telerik team
This is the default behavior for ASP.NET controls.
You can test the same scenario using the asp:TreeView and the same will be rendered:
<
asp:TreeView
runat
=
"server"
ID
=
"TreeView1"
>
<
Nodes
>
<
asp:TreeNode
Text
=
"1 < 2"
/>
<
asp:TreeNode
Text
=
"1 < 2"
/>
</
Nodes
>
</
asp:TreeView
>
Regards, Nikolay Tsenkov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now