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

Javascript error if a span tag is in Node text

1 Answer 68 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Tommy Walsh
Top achievements
Rank 1
Tommy Walsh asked on 10 Jun 2009, 05:21 AM

Hi,

I'm setting the node text on databind, with some HTML tags in the text. This has been no problem, except recently. If there are one or more <span> tags in the text, I get a javascript error on mouseover:

Message: 'this._element' is null or not an object
Line: 178
Char: 1
Code: 0
URI: http://localhost:1360/ScriptResource.axd?d=DMsgcAGno5aOYK0aJwUvXdDJxcknSyeyRU4cG7Y7I2kuvLi_brGedLWr9i1aLqYyY_ZriuetXXzd7bzZtgAS4w2&t=633798049441157248


If I remove the <span> tags, everything works flawlessly. Is there any way I can fix this without removing my span tags?

1 Answer, 1 is accepted

Sort by
0
Paul
Telerik team
answered on 10 Jun 2009, 10:24 AM
Hi Tommy,

Putting arbitrary HTML in the node's text may lead to invalid HTML since the text of the node is rendered in a SPAN tag. For example It is not permitted to render DIV within SPAN tags.

On a side note you can use templates runtime. I suggest you check this help topic for more details. You can even instantiate controls and add it to your Node's controls collection.

Sincerely yours,
Paul
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
TreeView
Asked by
Tommy Walsh
Top achievements
Rank 1
Answers by
Paul
Telerik team
Share this question
or