Hello All,
I created an aspx page in which I have a nested user control containing a dynamically created button. The problem is that everytime I click on it, the codebehind is not executed. It doesn't even enter in the code. The button was working before and I don't know what makes it bug . Here is the begining of the .aspx page :
<%@ Register TagPrefix="uc1" TagName="Layout" Src="/User_Controls/Layout.ascx" %>
<uc1:Layout id="ucLayout" ShowConsole=True RightColumn=False runat="server">
<CentreTemplate>
... some code ...
<asp:Button id="btnModify" runat="server" Text="Modify" Font-Size="XX-Small" Font-Names="Verdana,Arial" BorderStyle="Outset"></asp:Button>
.... some code ...
</CentreTemplate>
</uc1:Layout>
Then in the CodeBehind I have this :
At the top of the page :
Protected WithEvents btnModify As System.Web.UI.WebControls.Button
in The PageLoad :
btnModify = CType(ucLayout.FindControl("btnModify"), Button)
Then I have the click command of the button :
Public Sub btnModify_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnModify.Click
...some code ....
End Sub
Can someone help me find why my btnModify_Click is not executed.
I tried with an Hyperlink Button and it works. Why the simple button control doesn't want to work ?
Many Thanks.
I created an aspx page in which I have a nested user control containing a dynamically created button. The problem is that everytime I click on it, the codebehind is not executed. It doesn't even enter in the code. The button was working before and I don't know what makes it bug . Here is the begining of the .aspx page :
<%@ Register TagPrefix="uc1" TagName="Layout" Src="/User_Controls/Layout.ascx" %>
<uc1:Layout id="ucLayout" ShowConsole=True RightColumn=False runat="server">
<CentreTemplate>
... some code ...
<asp:Button id="btnModify" runat="server" Text="Modify" Font-Size="XX-Small" Font-Names="Verdana,Arial" BorderStyle="Outset"></asp:Button>
.... some code ...
</CentreTemplate>
</uc1:Layout>
Then in the CodeBehind I have this :
At the top of the page :
Protected WithEvents btnModify As System.Web.UI.WebControls.Button
in The PageLoad :
btnModify = CType(ucLayout.FindControl("btnModify"), Button)
Then I have the click command of the button :
Public Sub btnModify_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnModify.Click
...some code ....
End Sub
Can someone help me find why my btnModify_Click is not executed.
I tried with an Hyperlink Button and it works. Why the simple button control doesn't want to work ?
Many Thanks.
Last edited: