show window from the context menu in treeview serverside

2 posts, 0 answers
  1. shahab
    shahab avatar
    22 posts
    Member since:
    Oct 2012

    Posted 24 Sep 2008 Link to this post

    Hi, I have been trying to implement the following:

    I have a treeview on my page which has a contextmenu bound to it. 
    If I clicks on the contextmenu item (say--edit) I would like the window pop up with the nodeId and some other data . I have seen the example and the demos but they are all done on the client side. My problem is  I am trying to implement it from the server side.

    The following is the code so far. Any assistance in the right direction would be great.

    <telerik:RadTreeView ID="tvwUserWorkout" runat="server"   
            Skin="Telerik" OnNodeCreated="nodeCreated" 
                                OnContextMenuItemClick="RadTreeView1_ContextMenuItemClick">  
             <ContextMenus> 
                                    <telerik:RadTreeViewContextMenu ID="MyContextMenu" runat="server" Skin="Web20">  
                                        <CollapseAnimation Duration="200" Type="OutQuint" /> 
                                        <Items> 
                                            <telerik:RadMenuItem runat="server" Text="Completed" ImageUrl="~/Resources/Images/ui/cd_delete.png">  
                                            </telerik:RadMenuItem> 
                                            <telerik:RadMenuItem runat="server" Text="Edit" ImageUrl="~/Resources/Images/ui/cd_delete.png">  
                                            </telerik:RadMenuItem> 
                                            
                                           
                                            
                                           
                                        </Items> 
                                    </telerik:RadTreeViewContextMenu> 
                                </ContextMenus> 
        </telerik:RadTreeView> 

    protected void RadTreeView1_ContextMenuItemClick(object sender, Telerik.Web.UI.RadTreeViewContextMenuEventArgs e)  
        {  
     
            if (tvwUserWorkout.SelectedNodes.Count >= 1)  
            {  
               if (e.MenuItem.Text == "Edit")  
                {  
                    //fire up the dialog window  
                    RadWindow win = new RadWindow();  
                      
                }  
            }  
        } 
  2. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 25 Sep 2008 Link to this post

    Hello shahab,

    You should set the new created RadWindow's VisibleOnPageLoad property to true and add it to the form as shown below:

    RadWindow wnd = new RadWindow();  
    wnd.VisibleOnPageLoad = true;  
    this.form1.Controls.Add(wnd); 

    Note, that you can set all the desired properties as url, etc. in the same manner - wnd.PropertyName = PropertyValue.

    Regards,
    Svetlina
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top