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

Navigateurl doesn't work whn using global template

3 Answers 117 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
CSurieux
Top achievements
Rank 2
CSurieux asked on 19 Apr 2009, 02:48 PM
Hello,

Was is working before ?
When I add a general template to my treeview from codebehind, just as in the documentation sample, setting it in Oninit, the template works perfectly but i am loosing the navigateurl feature.

My treeview is built in a callback, if I remove the template and use a simple text, it starts again to navigate.
I was using template just to instantiate in a literal a <table>.

When I add my Text source for table directly in the node's Text property, table is displayed but node seems to have a space added before my table and it leads to have the node line arring on an empty area uppon the table. Navigation is also broken.

Any solutiuon to add a 'click to jump' table in a node welcome.

CS

3 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 20 Apr 2009, 10:36 AM
Hi Christian Surieux,

RadTreeView does not render a hyperlink if you set the node template. You should do that yourself like this:

<telerik:RadTreeView runat="server" ID="RadTreeView1">
        <NodeTemplate>
                    <table><tr><td><a href='<%# DataBinder.Eval(Container, "NavigateUrl") %>'>
<%#DataBinder.Eval(Container, "Text")%></a></td></tr></table>
         </NodeTemplate>
</telerik:RadTreeView>

Don't forget to call the DataBind method of your treeview after populating the nodes so the highlighted expressions are evaluated.

All the best,
Albert
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.
0
CSurieux
Top achievements
Rank 2
answered on 20 Apr 2009, 11:42 AM
Thanks,
I have done this, but I noticed that when Idon't use templates and set the code "<table><tr> etc </tr></table>" directly inside the Text property of RadTreenode, the table is correctly displyed but the NavigateUrl stops working.
Is it normal ?

CS
0
Atanas Korchev
Telerik team
answered on 20 Apr 2009, 11:48 AM
Hi Christian Surieux,

Embedding arbitrary HTML (such as tables) inside link tags is not guaranteed to work in all browsers. That's why we recommend using templates and avoid using HTML for the Text property.

Regards,
Albert
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
CSurieux
Top achievements
Rank 2
Answers by
Atanas Korchev
Telerik team
CSurieux
Top achievements
Rank 2
Share this question
or