title: SelectedIndexChanged to open a new form
body: <p>I have a web page with a datagridview where a user should be able to click on the selectindexchanged (in this case a "Select" button) show the results of what they have selected in a label on the second page and also redirect them to that page. Here is the code I have for the vb.net:</p>
  
  <pre><code>Imports System.Data.SqlClient
  Imports System.Data
  Partial Class _Default
      Inherits System.Web.UI.Page
      Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
          TimeDateLabel.Text = String.Format("Today is {0:F}", DateTime.Now)
          TextBox1.Focus()
      End Sub
      Protected Sub whosoncallButton_click(ByVal sender As Object, ByVal e As System.EventArgs) Handles whosoncallButton.Click
          Dim dt As New DataTable
          Dim da As New SqlDataAdapter
          Dim cmd As New SqlCommand
          Dim connectionString As String = "Initial Catalog=mdr;Data Source=xxxxx;uid=xxxxx;password=xxxxx"
          Dim con As New SqlConnection(connectionString)
          con.Open()
          cmd.Connection = con
          cmd.CommandType = CommandType.StoredProcedure
          cmd.CommandText = "getoncall"
          cmd.Parameters.AddWithValue("@subschedule", TextBox1.Text)
          Try
              da.SelectCommand = cmd
              da.Fill(dt)
              GridView1.DataSource = dt
              GridView1.DataBind()
              con.Dispose()
          Catch ex As Exception
              Response.Write("Error:" &amp; ex.Message)
          End Try
      End Sub
      Protected Sub clearButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles clearButton.Click
          TextBox1.Text = ""
          GridView1.DataSource = Nothing
          GridView1.DataBind()
      End Sub
      Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView1.SelectedIndexChanged
          Dim row As GridViewRow = GridView1.SelectedRow
          Response.Redirect("Default2.aspx?msg=" + row.Cells(1).Text)
      End Sub
  
  End Class
  </code></pre>
  
  <p>I have also added a line to my aspx page for the event handler. 
          </p>
  
  <p>I have debugged this but no matter what I've tried so far, the SelectIndexChanged event isn't firing. Can someone assist me on this please?</p>
  
  <p>Thank you</p>
  
  <p>Doug</p>