Open a textbox on radmenuitemclick

4 posts, 0 answers
  1. Nirmala
    Nirmala avatar
    22 posts
    Member since:
    May 2011

    Posted 11 Oct 2012 Link to this post

    Hi , 

     I wanted to open a popup with textbox and a button  when click on radmenuitem .

    I know i can achieve it by using radwindow but for radwindow i need to provide a Navigate Url to open it. For that i need to create a new aspx and refer it. 

    I want to open a popup div when i click on the radmenuitem instead of creating a new page. 

    Is it possible??

    Thanks,
    Nimmy
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 11 Oct 2012 Link to this post

    Hi Nirmala,

    One suggestion is that you can use ContentTemplate when you need to have the content in the same page where the RadWindow is declared. Following is the sample code that I tried based on your scenario.

    ASPX:
    <telerik:RadMenu ID="RadMenu1" runat="server" OnClientItemClicked="OnClientItemClicked">
       <Items>
          <telerik:RadMenuItem Text="RadMenuItem1">
          </telerik:RadMenuItem>
          <telerik:RadMenuItem Text="RadMenuItem2">
          </telerik:RadMenuItem>
       </Items>
    </telerik:RadMenu>
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server">
       <Windows>
          <telerik:RadWindow ID="RadWindow1" runat="server">
             <ContentTemplate>
               <telerik:RadTextBox ID="RadTextBox1" runat="server">
               </telerik:RadTextBox>
               <telerik:RadButton ID="RadButton1" runat="server">
               </telerik:RadButton>
             </ContentTemplate>
          <telerik:RadWindow>
       </Windows>
    </telerik:RadWindowManager>

    JS:
    <script type="text/javascript">
        function OnClientItemClicked(sender, args) {
            var oWnd = radopen("", "RadWindow1");
        }
    </script>

    Hope this helps.

    Regards,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Nirmala
    Nirmala avatar
    22 posts
    Member since:
    May 2011

    Posted 11 Oct 2012 Link to this post

    Thanks a lot Princy.. 

    What if i want to open the radwindow only for second menu item.
    <telerik:RadMenuItem Text="RadMenuItem2" />

    Can i open the radwindow from code behind?

    Thanks,
    Nirmala
  5. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 12 Oct 2012 Link to this post

    Hi Nirmala,

    One suggestion is that you can check the text of the RadMenuItem and open the RadWindow as follows.

    ASPX:
    <telerik:RadMenu ID="RadMenu1" runat="server" OnItemClick="RadMenu1_ItemClick" >
       <Items>
          <telerik:RadMenuItem Text="RadMenuItem1">
          </telerik:RadMenuItem>
          <telerik:RadMenuItem Text="RadMenuItem2">
          </telerik:RadMenuItem>
       </Items>
    </telerik:RadMenu>
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server">
       <Windows>
          <telerik:RadWindow ID="RadWindow1" runat="server">
             <ContentTemplate>
               <telerik:RadTextBox ID="RadTextBox1" runat="server">
               </telerik:RadTextBox>
               <telerik:RadButton ID="RadButton1" runat="server">
               </telerik:RadButton>
             </ContentTemplate>
          <telerik:RadWindow>
       </Windows>
    </telerik:RadWindowManager>

    C#:
    protected void RadMenu1_ItemClick(object sender, RadMenuEventArgs e)
        {
            if (e.Item.Text == "RadMenuItem2")
            {
                string scriptstring = "<script language='javascript'>function f(){var oWnd = radopen('', 'RadWindow1');}; Sys.Application.add_load(f);</script>";
                Page.ClientScript.RegisterStartupScript(this.GetType(), "radalert", scriptstring);
            }
        }

    Hope this helps.

    Regards,
    Princy.
Back to Top