Navigateurl doesn't work whn using global template

4 posts, 0 answers
  1. CSurieux
    CSurieux avatar
    465 posts
    Member since:
    Jan 2007

    Posted 19 Apr 2009 Link to this post

    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
  2. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 20 Apr 2009 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. CSurieux
    CSurieux avatar
    465 posts
    Member since:
    Jan 2007

    Posted 20 Apr 2009 Link to this post

    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
  5. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 20 Apr 2009 Link to this post

    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.
Back to Top