I'm writing an asp web application. It is one page, and functions as a search engine to bring up some data through sql into a gridview. There are two elements to the data - its code, and its description. You can either search for it by code, or by description. So I have a code textbox and button, and a description textbox and button. But pressing the enter key only submits the search for the first button on the page (code).
Is there any way I can make hitting the enter key submit the button that corresponds with that textbox that they are currently in?
    Protected Sub Button1_click(sender As Object, e As EventArgs) Handles Button1.Click    
          Dim tCodeText As String
      Label1.Text = ""
     TextBox2.Text = ""
      If String.IsNullOrWhiteSpace(TextBox1.Text) Then
        GridView1.Columns.Clear()
        GridView1.DataBind()
      Else
        tCodeText = TextBox1.text
        SqlDataSource1.SelectCommand = "SELECT * FROM [tCodes] WHERE [TCode] LIKE '%" + tCodeText + "%'"
        GridView1.Visible = "True"
        If Gridview1.Rows.Count = 0 Then
           Label1.Text = "No results meet your search criteria"
        End If
      End If
    End Sub
    Protected Sub Button2_click(sender As Object, e As EventArgs) Handles Button2.Click
      Dim descText As String
      Dim splitArray() As String
      Dim sqlText As String
      Label1.Text = "" 
    TextBox1.Text = ""
      If String.IsNullOrWhiteSpace(TextBox2.Text) Then
GridView1.Columns.Clear()
        GridView1.DataBind()
      Else
        DescText = TextBox2.text
        splitArray = Split(descText)
        sqlText = "SELECT * FROM [tCodes] WHERE [Description] LIKE '%" + splitArray(0) + "%'"
        For index = 0 To splitArray.Length - 1
          sqlText += "OR [Description] LIKE '%"
          sqlText += splitArray(index)
          sqlText += "%' "
        Next
        SqlDataSource1.SelectCommand = sqlText
        GridView1.Visible = "True"
If Gridview1.Rows.Count = 0 Then
        Label1.Text = "No results meet your search criteria"
      End If
      End If
    End Sub
 
     
    