I am using ASP.NET 2.0.
When i place a TRY CATCH block in my event it always go into the CATCH section, in my case it re-direct the page to Default.aspx. But if I remove the TRY CATCH block the code get's executed fine and it does what it suppose to.
Protected Sub gridResults1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles gridResults1.SelectedIndexChanged
Try
Dim selectedRowIndex As Integer
selectedRowIndex = gridResults1.SelectedIndex
Dim row As GridViewRow = gridResults1.Rows(selectedRowIndex)
Dim theCompanyProfile As String = gridResults1.DataKeys(selectedRowIndex).Value
Response.Redirect("Report.aspx?ID=" + theCompanyProfile)
Catch ex As Exception
Response.Redirect("Default.aspx")
End Try
End Sub
- There is no error message when i place a break point by the "Catch ex As Exception"
- Am I reading the selectedRowIndex DataKey value incorrectly maybe?
Thanks in advanced!