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

Open RadWindow with a RadMenu

2 Answers 294 Views
Menu
This is a migrated thread and some comments may be shown as answers.
arturo
Top achievements
Rank 1
arturo asked on 29 Apr 2011, 05:57 PM
Hi all

first of all thanks for reading this thread
I have a small problem when trying to open a RadWindow by clicking on a radmenu, I have this code

 

<script type="text/javascript">
  
  
function MenuOpenWindow(sender, eventArgs)
  
  
//If you open the window by javascript, you will need to
  
  
//cancel the postback event and to execute the javascript:
  
  
  
//Checks which item is clicked
  
  
if (eventArgs.Item.Text == "Change Password")
  
{
  
//open a pre-defined window from the RadWindowManager's
  
  
//Windows collection
  
  
radopen(null,"Window1");
  
//Cancel the postback
  
  
return false;
  
}
  
  
</script>
<telerik:RadMenu ID="RadMenu1" runat="server" style="left: 1px; top: -1px" Width="100%" OnClientItemClicked="MenuOpenWindow">
  
<Items>
  
<telerik:RadMenuItem runat="server" ImageUrl="~/img/home.png" Text="Profile" Value="Profile">
  
</telerik:RadMenuItem>
  
<telerik:RadMenuItem runat="server" Text="Groups" ImageUrl="~/img/edit_group.png" Value="Groups">
  
<Items>
  
<telerik:RadMenuItem runat="server" Text="Create Group" ImageUrl="~/img/add_group.png" Value="Create Group">
  
</telerik:RadMenuItem>
  
<telerik:RadMenuItem runat="server" Text="View Group" ImageUrl="~/img/search_group.png" Value="View Group">
  
</telerik:RadMenuItem>
  
</Items>
  
</telerik:RadMenuItem>
  
<telerik:RadMenuItem runat="server" Text="E Lerning" ImageUrl="~/img/Tips.png" Value="E Lerning">
  
<Items>
  
<telerik:RadMenuItem runat="server" Text="Create Tip" ImageUrl="~/img/Create_Tip.png" Value="Create Tip">
  
</telerik:RadMenuItem>
  
<telerik:RadMenuItem runat="server" Text="View Tips" ImageUrl="~/img/Search_Tip.png" Value="View Tips">
  
</telerik:RadMenuItem>
  
</Items>
  
</telerik:RadMenuItem>
  
<telerik:RadMenuItem runat="server" Text="Account" ImageUrl="~/img/Account.png" Value="Account">
  
<Items>
  
<telerik:RadMenuItem runat="server" Text="Change Password" ImageUrl="~/img/key.png" Value="Change Password">
  
</telerik:RadMenuItem>
  
<telerik:RadMenuItem runat="server" ImageUrl="~/img/exit.png" Text="Log Out" Value="Log Out">
  
</telerik:RadMenuItem>
  
</Items>
  
</telerik:RadMenuItem>
  
</Items>
  
</telerik:RadMenu>
when clicking an item of radmenu gives me the error: Message: 'Item.Text' is null or not an object
Line: 16
Char: 15
Code: 0
URI: http://localhost:4853/DensoNetWork/Main.aspx

I think I'm doing something wrong
thanks and regards

excuse me if my English is a little bad

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 30 Apr 2011, 05:55 AM
Hello Arturo,

I have modified your code as below.

Javascript:
<script type="text/javascript">
  function MenuOpenWindow(sender, eventArgs)
  {
    if (eventArgs.get_item().get_text() == "Change Password")
    {
    radopen(null,"Window1");
    return false;
    
  } 
</script>

Also take a look at the following documentation.
RadMenuItemCollection object.

Thanks,
Princy.
0
arturo
Top achievements
Rank 1
answered on 02 May 2011, 07:47 PM
thx princy, it works =)

regards
Tags
Menu
Asked by
arturo
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
arturo
Top achievements
Rank 1
Share this question
or