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

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

1 Answer 83 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Bruce Timmins
Top achievements
Rank 1
Bruce Timmins asked on 15 Dec 2009, 02:02 AM
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

1 Answer, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 15 Dec 2009, 06:28 AM
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.
Tags
Ajax
Asked by
Bruce Timmins
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or