How to make asp.net button work in the RadWindow?

2 posts, 1 answers
  1. Bruce Timmins
    Bruce Timmins avatar
    2 posts
    Member since:
    Oct 2006

    Posted 14 Dec 2009 Link to this post

    Hi everyone,

    I got a problem having the asp.net button work in the RadWindow control. It seems did not trigger the server side click event. Here is the code below:                
                     <telerik:RadWindow ID="radWindow1" runat="server" Behavior="Move,Close,Reload">
                            <ContentTemplate>
                                <p>
                                    hello</p>
                                <br />
                                <b>world</b>
                                <asp:Button ID="btn_Popup" runat="server" Text="Load Popup" OnClick="btn_Popup_Click"/>
                            </ContentTemplate>
                        </telerik:RadWindow>

    Thanks,

    Bruce
  2. Answer
    Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 15 Dec 2009 Link to this post

    Hi Bruce,

    I tried the same code and it is not working in my end also, the buttonClick event is not fired. One suggestion to achieve the scenario is placing the controls needed in UserControl and load the usercontrol in RadWindow as shown below.

    ASPX:
     
        <telerik:RadWindow ID="radWindow1" runat="server" VisibleOnPageLoad="true" 
            Behavior="Move,Close,Reload"
            <ContentTemplate> 
                <uc1:Content ID="Content1" runat="server" /> 
            </ContentTemplate> 
        </telerik:RadWindow> 
        <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> 

    And in ascx:
     
    <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" /> 

    CS:
     
        protected void Button1_Click(object sender, EventArgs e) 
        { 
            Button btn = (Button)sender; 
            UserControl uc = (UserControl)btn.NamingContainer; 
            Page p = (Page)uc.NamingContainer.Parent.NamingContainer; 
            Label lbl = (Label)p.FindControl("Label1"); // accessing the control on page 
            lbl.Text = "new text"
        } 

    -Shinu.
Back to Top