Displaying radWindow when radTreeNode is clicked

3 posts, 0 answers
  1. Aarsh
    Aarsh avatar
    192 posts
    Member since:
    Jun 2012

    Posted 25 Jul 2012 Link to this post

    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. DroidSlave
    DroidSlave avatar
    5 posts
    Member since:
    Sep 2012

    Posted 05 Dec 2012 Link to this post

    Any answer on this, I am trying to accomplish the same thing.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 10 Dec 2012 Link to this post

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