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

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

2 Answers 46 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Pradeep Enugala
Top achievements
Rank 1
Pradeep Enugala asked on 29 Dec 2011, 02:42 PM
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");

 


RadTreeNode

 

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

 

node.Nodes.Add(subnode);


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 Answers, 1 is accepted

Sort by
0
Bozhidar
Telerik team
answered on 30 Dec 2011, 03:46 PM
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,
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
Pradeep Enugala
Top achievements
Rank 1
answered on 03 Jan 2012, 01:14 PM
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
Pradeep
Tags
TreeView
Asked by
Pradeep Enugala
Top achievements
Rank 1
Answers by
Bozhidar
Telerik team
Pradeep Enugala
Top achievements
Rank 1
Share this question
or