Triggering Button clicked event when I hit enter key at edit box....

Discussion in 'ASP .Net' started by Veeresh, Jun 16, 2004.

  1. Veeresh

    Veeresh Guest

    When I enter some data in textbox1 and hit enter key resulting in calling
    the clicked event of Button1. What I am doing wrong here?
    -- Veeresh
    Here is my code.

    <%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm2.aspx.vb"
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <meta name="GENERATOR" content="Microsoft Visual Studio.NET 7.0">
    <meta name="CODE_LANGUAGE" content="Visual Basic 7.0">
    <meta name="vs_defaultClientScript" content="JavaScript">
    <meta name="vs_targetSchema"
    <body MS_POSITIONING="GridLayout">
    <form id="Form1" method="post" runat="server">
    <TABLE id="Table1" style="Z-INDEX: 101; LEFT: 224px; POSITION: absolute;
    TOP: 203px" cellSpacing="1" cellPadding="1" width="300" border="1">
    <asp:TextBox id="TextBox1" tabIndex="1"
    <asp:TextBox id="TextBox2" tabIndex="2"
    <asp:Button id="Button1" tabIndex="3" runat="server"


    Public Class WebForm2

    Inherits System.Web.UI.Page

    Protected WithEvents TextBox1 As System.Web.UI.WebControls.TextBox

    Protected WithEvents TextBox2 As System.Web.UI.WebControls.TextBox

    Protected WithEvents Button1 As System.Web.UI.WebControls.Button

    #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.


    End Sub

    #End Region

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

    'Put user code to initialize the page here

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles Button1.Click

    End Sub

    End Class
    Veeresh, Jun 16, 2004
    1. Advertisements

  2. Steve C. Orr [MVP, MCSD], Jun 16, 2004
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.