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

Displaying radWindow when radTreeNode is clicked

2 Answers 140 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Aarsh
Top achievements
Rank 1
Aarsh asked on 25 Jul 2012, 10:25 PM
Hi friends,

I've a popup.aspx file that I want to display when I click the radTreeNode.
I am programmatically loading the nodes and their individual urls.

Below is the code snippet of another C# code that does this.

if (collection.rows.Count > 0)
{
    ScanNode = new RadTreeNode("View Scan: " + scan.CratedDate.ToShortDateString(), ScanID.ToString());
    SetNavigationOnNode(ScanNode , User.GetApplicationPath() + "/Imaging/Popup.aspx? <QuerySting Variable and their values> "&Image=" + ImageID);
    proceedingNode.Nodes.Add(proceedingScanNode);
}

SetNavigationOnNode
is a function and looks something like this:

private void SetNavigationOnNode(RadTreeNode node, string url)
{
    if (needPopupJS)
        node.Attributes.Add("onclick", GetRadWindowJS(url));
    else
        node.NavigateUrl = url;
}


Everything is fine but I want to open it us as pop up rather new window.

Thanks,
-Aarsh

2 Answers, 1 is accepted

Sort by
0
DroidSlave
Top achievements
Rank 2
answered on 05 Dec 2012, 05:04 PM
Any answer on this, I am trying to accomplish the same thing.
0
Boyan Dimitrov
Telerik team
answered on 10 Dec 2012, 02:22 PM
Hello,

I would recommend you to use a single instance of RadWindow control for popup window on your page and load different page based on the selected node. You can declare an handler for OnClientNodeClicked event instead of setting "onclick" as attribute for the node.

//markup code
<telerik:RadTreeView ID="RadTreeView1" runat="server" OnClientNodeClicked="ClientNodeClicked">
          ............
</telerik:RadTreeView>

//JavaScript
function NodeClientClicked(sender, args) {
            var nodeText = args.get_node().get_text();
            var oWnd = $find("<%= RadWindow1.ClientID %>");
            oWnd.show();
            oWnd.setSize(400, 400);
            oWnd.setUrl(nodeText);
        }

Please find attached a project that implements the described approach to achieve the desired functionality.

Regards,
Boyan Dimitrov
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.
Tags
TreeView
Asked by
Aarsh
Top achievements
Rank 1
Answers by
DroidSlave
Top achievements
Rank 2
Boyan Dimitrov
Telerik team
Share this question
or