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

Open a textbox on radmenuitemclick

3 Answers 124 Views
Input
This is a migrated thread and some comments may be shown as answers.
Nirmala
Top achievements
Rank 1
Nirmala asked on 12 Oct 2012, 03:27 AM
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

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 12 Oct 2012, 03:53 AM
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.
0
Nirmala
Top achievements
Rank 1
answered on 12 Oct 2012, 04:12 AM
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
0
Princy
Top achievements
Rank 2
answered on 12 Oct 2012, 06:43 AM
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.
Tags
Input
Asked by
Nirmala
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Nirmala
Top achievements
Rank 1
Share this question
or