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

How to use Radwind from server side code

1 Answer 95 Views
Window
This is a migrated thread and some comments may be shown as answers.
zt
Top achievements
Rank 1
zt asked on 28 Nov 2008, 02:53 PM
Hello,
        I'm using your telerik controls for Asp.net ajax. I have a RadTreeview  control on the page.Now I can easily get the value of the selected tree node. I want to show a Radwindow dynamically by the value of this tree node and then load a page in this window.
Let's express it like this: now I have a RadTreeview displaying all the categories, one category contains many product .When I click on one product node,a Radwindow will show and display details information about this produt.But now I can't show a Radwindow using server side code.   Hope some one can show me the way, some sample code would be great. Thanks.

1 Answer, 1 is accepted

Sort by
0
Petko
Telerik team
answered on 28 Nov 2008, 05:11 PM
Hi,

I prepared a small sample for you, that shows how to achieve the desired behavior.

ASPX:
<body> 
    <form id="form1" runat="server">  
    <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager> 
    <div> 
      <script type="text/javascript">  
     function openWindow(url)  
     {   
        setTimeout('var win = radopen("'+url+'",null)',50);  
     
     }  
       
     function nodeClicked(sender,args)  
     {  
        args.get_node().expand();  
     }  
    </script> 
        <telerik:RadTreeView ID="RadTreeView1" runat="server" OnNodeClick="RadTreeView1_NodeClick" 
         OnClientNodeClicked="nodeClicked">  
            <Nodes> 
                <telerik:RadTreeNode Text="Search" Value="Category1">  
                    <Nodes> 
                        <telerik:RadTreeNode Text="Google" Value="http://google.com"></telerik:RadTreeNode> 
                        <telerik:RadTreeNode Text="Yahoo" Value="http://yahoo.com"></telerik:RadTreeNode> 
                        <telerik:RadTreeNode Text="Wiki" Value="http://en.wikipedia.org/wiki/Main_Page"></telerik:RadTreeNode> 
                    </Nodes> 
                </telerik:RadTreeNode> 
                <telerik:RadTreeNode Text="WebMail" Value="Category2">  
                  <Nodes> 
                       <telerik:RadTreeNode Text="Gmail" Value="https://gmail.com"></telerik:RadTreeNode> 
                  </Nodes> 
                </telerik:RadTreeNode> 
                <telerik:RadTreeNode Text="Other" Value="Category3">  
                  <Nodes> 
                        <telerik:RadTreeNode Text="Telerik" Value="http://www.telerik.com"></telerik:RadTreeNode> 
                  </Nodes> 
                </telerik:RadTreeNode> 
             </Nodes> 
        </telerik:RadTreeView> 
        <telerik:RadWindowManager ID="RadWindowManager1" runat="server" Width="700" Height="700" re></telerik:RadWindowManager> 
      </div> 
    </form> 
</body> 

Code-behind:
protected void RadTreeView1_NodeClick(object sender, RadTreeNodeEventArgs e)  
    {  
        if (e.Node.Level > 0)  
        {  
            string script = String.Format(@"openWindow(""{0}"");", e.Node.Value);  
            ScriptManager.RegisterStartupScript(this, this.GetType(), "openWin", script, true);  
        }  
    } 

I hope this helps.

Kind regards,
Petko
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Window
Asked by
zt
Top achievements
Rank 1
Answers by
Petko
Telerik team
Share this question
or