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

Context Menu Item open a popup through javascript

1 Answer 173 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Julie
Top achievements
Rank 1
Julie asked on 02 Feb 2009, 08:48 PM
Hello Telerik Community,
I am working with the radTreeview with a radtreeview context menu.  I need to open a modal popup via javascript from one of the menu items. 
Could you please explain how to go about this.
Thanks in advance.
~Julie

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 03 Feb 2009, 07:58 AM
Hi Julie,

Try the below code for opening a modal RadWindow on clicking the ContextMenuItem.
ASPX:
<telerik:RadTreeView ID="RadTreeView1" Runat="server"  EnableDragAndDrop="true" OnClientContextMenuItemClicking="OnClientContextMenuItemClicking">  
<ContextMenus>  
<telerik:RadTreeViewContextMenu ID="CMenu">  
<Items>  
     <telerik:RadMenuItem Text="Show Window"></telerik:RadMenuItem>  
     <telerik:RadMenuItem Text="Delete"></telerik:RadMenuItem>          
</Items>  
</telerik:RadTreeViewContextMenu>  
</ContextMenus>  
    <Nodes>  
       . . .  
    </Nodes>  
</telerik:RadTreeView> 
<telerik:RadWindow ID="RadWindow1" runat="server"
</telerik:RadWindow> 

JavaScript:
<script type="text/javascript"
function OnClientContextMenuItemClicking(sender, eventArgs) 
    var item = eventArgs.get_menuItem(); 
    if (item.get_text() == "Show Window"
    { 
        var oWnd = $find("<%=RadWindow1.ClientID%>"); 
        oWnd.setUrl('http://www.google.com');    //Set the URL 
        oWnd.set_modal(true); 
        oWnd.show();  
    } 
</script> 

You can also refer to the following online documentation which explains about several ways to open RadWindow from client side.
Opening Windows

Thanks,
Shinu.
Tags
TreeView
Asked by
Julie
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or