Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (edited)

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.

Edited by scalf

Scalf.

Do not want others to know what you have done? Better not have done it anyways.

Posted

You do not need the following line:

 

btnModify = CType(ucLayout.FindControl("btnModify"), Button)

 

This is probably unsetting the control and causing the error.

Posted

No, removing the line btnModify = CType(ucLayout.FindControl("btnModify"), Button) does not change anything...

 

Any other idea ?

 

Many thanks.

 

NB : Can it be the Framework 1.1 version which is bugging ?

Scalf.

Do not want others to know what you have done? Better not have done it anyways.

Posted

OK many thanks, here is the aspx page and .vb code. Sorry, the variables and functions have French names...I hope it will not be a problem.

 

Many thanks for all of you!!!

Scalf.

Do not want others to know what you have done? Better not have done it anyways.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...