VB.NET button click event not fired in any added new button

Discussion in 'ASP .Net Web Controls' started by Coo Coo, Oct 26, 2004.

  1. Coo Coo

    Coo Coo Guest

    Hi all,
    Working on VS in VB.NET in some pages which where all fine before, I
    can't add a button of any kind and get the click event fired. I
    already checked that there is an event handler (Tried both in the html
    and the code behind)
    When I debug I can see that the page does not even go to the event
    handler. I checked all the button events and it seems that the
    following are fired on page load: Init, Load and unload.
    When I click the button itself nothing happens.
    Any Idea?
    Here is the code with necessary abbreviations:
    Thanks for any reply,
    Toro.

    ASPX code:
    <%@ Page Language="vb" CodeBehind="help.aspx.vb"
    AutoEventWireup="false" Inherits="IBuySpy.help" %>
    <%@ Register TagPrefix="IBuySpy" TagName="Header" Src="_Header.ascx"
    %>
    <%@ Register TagPrefix="IBuySpy" TagName="Menu" Src="_Menu.ascx" %>
    <HTML dir="rtl">
    <HEAD>
    <title></title>
    <meta content="False" name="vs_showGrid">
    <LINK href="IBuySpy.css" type="text/css" rel="stylesheet">
    </HEAD>

    <body>
    <P><FONT face="Arial">
    <asp:Button id="EncryptButton" runat="server"
    Text="Encrypt" OnClick="EncryptButton_Click"></asp:Button>
    <asp:Button id="DecryptButton" runat="server"
    Text="Decrypt"></asp:Button><BR>
    <FONT size="2"></FONT></FONT>
    </P>

    CODE BEHIND

    Public Class help
    Inherits System.Web.UI.Page
    Protected WithEvents Image1 As System.Web.UI.WebControls.Image
    Protected WithEvents EncryptButton As
    System.Web.UI.WebControls.Button
    Protected WithEvents DecryptButton As
    System.Web.UI.WebControls.Button
    Protected WithEvents WelcomeMsg As System.Web.UI.WebControls.Label
    #Region " Web Form Designer Generated Code "
    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub
    InitializeComponent()
    End Sub

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles MyBase.Init
    'CODEGEN: This method call is required by the Web Form
    Designer
    'Do not modify it using the code editor.
    InitializeComponent()
    End Sub
    #End Region


    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles MyBase.Load
    Some code here......
    End Sub

    Public Sub EncryptButton_Click(ByVal sender As System.Object,
    ByVal e As System.EventArgs) Handles EncryptButton.Click
    Some code here......
    End Sub
    End Class
     
    Coo Coo, Oct 26, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page