RadMenu Item Click-- New Widow

7 posts, 0 answers
  1. Jagat
    Jagat avatar
    135 posts
    Member since:
    Jan 2011

    Posted 26 Jul 2011 Link to this post

    Hello ,

      I have a RadMenu in my web application. For one of the Rad Menu Item, I would like to open the form in new window. I have tried the Target="_blank". It is not working. I also tried through javascript
    function clickHandler(sender, eventArgs)
              {    
            
                  if (eventArgs.item.Text == "LunchBreak")
                  {
                       //open a pre-defined window from the RadWindowManager's
                       //Windows collection
                      radopen(null,"Window1");
                      //Cancel the postback
                      return false;
                  }
              }

     <telerik:RadMenu ID="RadMenu1" runat="server" orientation="Horizontal" Skin="Windows7" OnClientItemClicking="clickHandler"
                     
                    EnableRoundedCorners="True" EnableShadows="True" Height="39px"   Width="100%"
                    CausesValidation="False">
                    <Items>
                    <telerik:RadMenuItem runat="server" Text="Home" ImageUrl="~/Images/Home.png"
                            NavigateUrl="~/frm_HomePage.aspx">
                             
                        </telerik:RadMenuItem>
                        
                                         
                        <telerik:RadMenuItem runat="server" Text="Login" ImageUrl="~/Images/Unlock.png" PostBack="False"    Height="35px"
                            NavigateUrl="">
                             <Items>
                              <telerik:RadMenuItem runat="server" Text=" Driver Login" Value="Login"
                                    NavigateUrl="~/frm_DriversLogin.aspx" ImageUrl="~/Images/Users-2.png" Height="35px">
                                </telerik:RadMenuItem>
                               </Items>
                        </telerik:RadMenuItem>
                       <telerik:RadMenuItem runat="server" Text="Trip Information" PostBack="False"
                            ImageUrl="~/Images/Users-Details.png" >
                            <Items>
                                
                                <telerik:RadMenuItem runat="server" NavigateUrl="~/frm_RouteDetails.aspx"
                                    Text="View/Edit Trips" Value="View Trips" ImageUrl="~/Images/Worker-Edit.png" Height="35px">
                                </telerik:RadMenuItem>
                                                                                 </Items>
                        </telerik:RadMenuItem>
                         <telerik:RadMenuItem runat="server" Text="Break" PostBack="False"  
                               ImageUrl="~/Images/ClockNew.png" >
                            <Items>
                            <telerik:RadMenuItem runat="server" Text="LunchBreak"   Target="_blank"
                                    Value="Lunch Break" ImageUrl="~/Images/Worker-Time.png"  Height="35px">
                                </telerik:RadMenuItem>
                                
                                <telerik:RadMenuItem runat="server" Text="Break1"  Target="_blank"
                                    Value="Break 1" ImageUrl="~/Images/Worker-Time.png" Height="35px">
                                    
                                </telerik:RadMenuItem>
                                 <telerik:RadMenuItem runat="server" Text="Break2"  Target="_blank"
                                    Value="Break 2" ImageUrl="~/Images/Worker-Time.png" Height="35px">
                                    
                                </telerik:RadMenuItem>
                                 <telerik:RadMenuItem runat="server" Text="Break3"  Target="_blank"
                                    Value="Break 3" ImageUrl="~/Images/Worker-Time.png" Height="35px">
                                    
                                </telerik:RadMenuItem>
                                 </Items>
                        </telerik:RadMenuItem>
                        </Items>
                        
                        </telerik:RadMenu>
                      <telerik:RadWindowManager ID=RadWindowManager1 runat=server>   
           <Windows>  
               <telerik:RadWindow ID=Window1 runat=server NavigateUrl="frm_BreakTime.aspx" />  
           </Windows>  
       </telerik:RadWindowManager>  


    The Run time error I am getting.......

    Microsoft JScript runtime error: 'item.Text' is null or not an object

    Thanks


  2. Jagat
    Jagat avatar
    135 posts
    Member since:
    Jan 2011

    Posted 26 Jul 2011 Link to this post

    Hello,
     Just a small update on my question..
     I have tried Target= parent also. that didn't work too.
    I followed the code behind sample in the link below.
    http://www.telerik.com/help/aspnet/window/openwindowfrommenu.html
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 27 Jul 2011 Link to this post

    Hello Jagat,

    Try the following code snippet to open a window from MenuItemClick.

    C#:
    protected void RadMenu1_ItemClick(object sender, Telerik.Web.UI.RadMenuEventArgs e)
      {
     if (e.Item.Text == "Break")
         {
             RadWindow rw = new RadWindow();
             rw.Width = Unit.Pixel(260);
             rw.Height = Unit.Pixel(300);
             rw.NavigateUrl = "Window.aspx";
             rw.VisibleOnPageLoad = true;
             RadWindowManager1.Windows.Add(rw);
         }
      }
    JS:
    <script type="text/javascript">
    function OnClientItemClicking(sender,eventArgs)
     {
       if(eventArgs.get_item().get_text()=="LunchBreak")
          {
            radopen(null,"window.aspx");
            return false;
          }
     }
    </script>

    Thanks,
    Shinu.
  5. Jagat
    Jagat avatar
    135 posts
    Member since:
    Jan 2011

    Posted 27 Jul 2011 Link to this post

    New window is opening but i have a problem. Suppose, I am in form which has Radgrid in it and when I click the menu item here, the new window is opening but, when i close that new window and edit the grid, the new window is opening again. For each and every postback in the old window, the new window is opening.

    Thanks
  6. Kate
    Admin
    Kate avatar
    1898 posts

    Posted 29 Jul 2011 Link to this post

    Hi Jagat,

    Can you provide markup of the scenario that you describe in the previous forum post?

    Thanks in advance.

    Regards,
    Kate
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  7. Ridwaan
    Ridwaan avatar
    2 posts
    Member since:
    Nov 2008

    Posted 12 Jan 2012 Link to this post

    Hi, I had the same problem, I just altered the "VisibleOnPageLoad" and set it to "false"
    Works fine now 

     

    if (e.Item.Text == "New Single Instrucion")

    {

     

    RadWindow rw = new RadWindow();

    rw.Width =

     

    Unit.Pixel(260);

    rw.Height =

     

    Unit.Pixel(300);

    rw.NavigateUrl =

     

    "newwo.aspx";

    rw.VisibleOnPageLoad =

     

    false;

    rw.Skin =

     

    "Transparent";

     

    RadWindowManager1.Windows.Add(rw);

  8. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 12 Jan 2012 Link to this post

    Hello Ridwaan,

    When you are setting VisibleOnPageLoad property as true, the window will open each time after a postback. Check the following sticky thread which explains how to open window from server side.
    Opening RadWindow from the server

    -Shinu.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017