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

html tags in node text

4 Answers 96 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Becky
Top achievements
Rank 1
Becky asked on 30 Mar 2012, 06:42 PM
I have two websites, both .net 4, both using telerik dll 2012.215.1.40, and they do not render treeview nodes with html tags the same way. See attached files - "goodtree" is the desired behavior. I added a plain unordered list in "badtree" for comparison to see if all of my code was affected (something web.config or app pool related), but it is only the treeview. I am stumped. How can I get "badtree" to render the html instead of printing out the tags?

4 Answers, 1 is accepted

Sort by
0
Bozhidar
Telerik team
answered on 02 Apr 2012, 08:19 AM
Hello Becky,

Please go to the following forum topic, which explains why this occurs and how to fix it:
http://www.telerik.com/community/forums/aspnet-ajax/treeview/known-issues-and-breaking-changes.aspx 
 
All the best,
Bozhidar
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
John
Top achievements
Rank 1
answered on 02 Apr 2012, 01:53 PM
Thank you, I did see that note. Using an internal build is not an option for our environment and it also didn't explain why the trees behaved differently using the exact same dll. I did find the problem: the tree that works has a NavigateURL specified for the nodes, and the other tree does not. I can add it to the "broken" tree, but it degrades the performance, adding a click event when we don't need it. I'm guessing I need to trap & cancel the click event client-side?
0
Accepted
Bozhidar
Telerik team
answered on 03 Apr 2012, 07:03 AM
Hi John,

The fix will also be available in our upcoming Service Pack, which should come out in two weeks.

About the different behavior, when you set a NavigateUrl to a treenode, the text of the node is rendered inside a <a href> tag, as opposed to a <span> tag, which is the normal case. With the current implementation of the encoding mechanism in version 2012.1.215 this causes the text not to be encoded.

This is one of the problems that led to the decision to fix the whole encoding mechanism and introduce a property that controls whether the text should be encoded. I strongly recommend upgrading to the Service Pack once it comes out, since all these issues are already fixed.

However if you want to use the 2012.1.215 version and cancel the default behavior of the link generated by setting the NavigateUrl property, you can do it by simply removing the href attribute of the link on the OnClientLoaded event:
function clientLoad(sender) {
    var nodes = sender.get_allNodes();
 
    for (var i = 0; i < nodes.length; i++) {
        $telerik.$(".rtIn", nodes[i].get_element()).removeAttr('href');
    }
}

 
Greetings,
Bozhidar
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
Becky
Top achievements
Rank 1
answered on 03 Apr 2012, 01:54 PM
Thank you, Bozhidar! Knowing that the service pack is only 2 weeks away is good news. Thank you also for the workaround - this is very helpful in case I am pushed to go live sooner.

-Becky
Tags
TreeView
Asked by
Becky
Top achievements
Rank 1
Answers by
Bozhidar
Telerik team
John
Top achievements
Rank 1
Becky
Top achievements
Rank 1
Share this question
or