Control within another control in asp.net disables server-side events?
Posted
by Xaisoft
on Stack Overflow
See other posts from Stack Overflow
or by Xaisoft
Published on 2010-03-24T17:26:02Z
Indexed on
2010/03/24
17:43 UTC
Read the original article
Hit count: 233
I have a control which has a button on it. All the button does is redirect the user to another page. On this control I have another control which just display some stuff, nothing fancy. When I click on the button, it does nothing. When I remove or comment out the other control, the button event works. Is this by design? I am not sure how to fix it or what is causing it.
ControlA.ascx contains a button with an event like so:
protected void Button1_Click(object sender, EventArgs e)
{
Response.Redirect("~/Home.aspx");
}
ControlA.ascx contains another control inside of it, lets call it ControlB.ascx.
The Button1 click event does not fire when ControlB.ascx is in ControlA.ascx, but when I remove it or take it out, Button1 event fires and it goes to Home.aspx. This does not only happen for Button1, if I decide to add a second button and create an event for it, if ControlB is in ControlA, the second button event won't fire either.
© Stack Overflow or respective owner