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

RadWindow - Passing value from RadTreeView to parent page

3 Answers 46 Views
Window
This is a migrated thread and some comments may be shown as answers.
Mattias Moberg
Top achievements
Rank 1
Mattias Moberg asked on 29 May 2011, 10:25 PM
Hi.
Im having this setup:

page.aspx
<asp:literal ID="pageName" runat="Server" Text="" />
I fire up dialog.aspx in RadWindow from page.aspx

dialog.aspx
RadTreeView
<asp:Button ID="SelectPageBtn" runat="server" Text="Select page"  />


What i need to achieve is to pass selected RadTreeNode to parent page (page.aspx) into literal control.

Anyone got suggestion for a clean solution ?
Thanks,

/Mattias

3 Answers, 1 is accepted

Sort by
0
Accepted
Marin Bratanov
Telerik team
answered on 30 May 2011, 11:05 AM

Hello Mattias,

I would recommend examining the following online demo: http://demos.telerik.com/aspnet-ajax/window/examples/dialogreturnvalue/defaultcs.aspx, which is very similar to your requirement. For more information on the available Client-side API of the RadTreeNode you can examine the following help article: http://www.telerik.com/help/aspnet-ajax/treeview-client-objects-radtreenode.html.

On a side note - the asp literal renders pure text on the page and thus cannot be accessed through JavaScript. What I would suggest is to use a label instead.

For your convenience I created and attached a simple page illustrating the approach.



Greetings,
Marin
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Mattias Moberg
Top achievements
Rank 1
answered on 30 May 2011, 08:54 PM
Hi,

Thanks for the help, did fit my needs.
I forgot one thing.

How is it possible to return parent node for selected node, with this code you did provide me ?

Thanks,
/Mattias
0
Accepted
Marin Bratanov
Telerik team
answered on 01 Jun 2011, 09:46 AM

Hi Mattias,

This is a matter of a simple check by using the methods available in the help article from my previous post. For your convenience I modified my functions accordingly:

if (nodes[0])
{
    if (nodes[0].get_parent() != nodes[0].get_treeView()) //check if the parent is not the treeview itself
    {
        oArg.selectedNode = nodes[0].get_parent().get_text();
    }
    else
    {
        //implement custom logic in case there is no parent node. I set it to undefined.
        oArg.selectedNode = undefined;
    }
}

and in the main page:

if (selectedNode != undefined)
{
    $get("<%=pageName.ClientID %>").innerHTML = selectedNode;
}
else
{
    setTimeout(function ()
    {
        $get("<%=pageName.ClientID %>").innerHTML = "";
    }, 0);
}


All the best,
Marin
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
Window
Asked by
Mattias Moberg
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Mattias Moberg
Top achievements
Rank 1
Share this question
or