Radnode click is not working properly when ImageURL and Text property are asigned

3 posts, 0 answers
  1. Pradeep Enugala
    Pradeep Enugala avatar
    55 posts
    Member since:
    Apr 2010

    Posted 29 Dec 2011 Link to this post

    Hi Telerik team,

    I'm working on RadTreeView structure.
    In my Project i'm adding the treeview structure dynamically.Here for each radnode adding the imageurl ,font size ,Navigateurl and text property.My tree view is displayed with tree node which has the Image and text  and for each node click i want to navigate to some other page with encrypted 'QueryString' value.Later in that page i can use the values available in 'Request.QueryString["--"]'.

    Now my issue is ,when i'm clicking on image the functionality is working fine and the Querystring value is not null.But when i'm clicking on the text ,the query string is null and throwing an exception.

    Please find the code below :


    RadTreeNode node = new RadTreeNode("Mainnodename");




    subnode = new RadTreeNode(sec.SectionName, sec.SectionId.ToString());



    subnode.Text = sec.SectionName.ToString();

    subnode.ToolTip = sec.SectionName.ToString();

    subnode.ImageUrl = sec.ImagePath;

    subnode.NavigateUrl = sec.pagePath;

    This is the declaration,
    when node is clicked redirecting the page like below statement:


    Response.Redirect(e.Node.NavigateUrl.ToString() +

    "?" + encryptedString, false);



    Here encrypted string is the 'QueryString' value.

    Please reply ASAP...

    Thank you..

  2. Bozhidar
    Bozhidar avatar
    1142 posts

    Posted 30 Dec 2011 Link to this post

    Hi Pradeep,

    The problem is that when you set the NavigateUrl property of the TreeNode, when you click on the text of the node, it uses the property to navigate to the page, rather than the Response.Redirect call in your C# code. 

    To negate that behaviour, you can set the NavigateUrl as an attribute of the treenode. Here's an example of this approach:

    subnode.Attributes["NavigateUrl"] = sec.pagePath;
    protected void RadTreeView1_NodeClick(object sender, RadTreeNodeEventArgs e)
        Response.Redirect(e.Node.Attributes["NavigateUrl"].ToString() + "?parameter=value", false);

    All the best,
    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
  3. Pradeep Enugala
    Pradeep Enugala avatar
    55 posts
    Member since:
    Apr 2010

    Posted 03 Jan 2012 Link to this post

    Hi Bozhidar,

    Thanks for your reply.
    It's working now.I have removed the NavigateURL property for the subnode and added the attribute with key 'NavigateURL' and used it while redirecting the page.

    Thank you
Back to Top