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

show window from the context menu in treeview serverside

1 Answer 54 Views
Window
This is a migrated thread and some comments may be shown as answers.
shahab
Top achievements
Rank 1
shahab asked on 24 Sep 2008, 06:11 AM
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();  
                  
            }  
        }  
    } 

1 Answer, 1 is accepted

Sort by
0
Svetlina Anati
Telerik team
answered on 25 Sep 2008, 03:22 PM
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.
Tags
Window
Asked by
shahab
Top achievements
Rank 1
Answers by
Svetlina Anati
Telerik team
Share this question
or