So I made each row of a GridView clickable using this method:
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes["OnClick"] = Page.ClientScript.GetPostBackEventReference(GridView1, "Select$" + e.Row.RowIndex.ToString());
}
}
So that when I click a row, the program redirects to Page1 via the GridView.SelectedRowChanged method.
Each row also contains some a HyperLink that is supposed to redirect to Page2. However, clicking on the HyperLink only redirects to Page1 because the SelectedRowChanged event fires first.
How do I redirect to the correct page when the HyperLink is clicked? Is it as simple as making the HyperLinks LinkButtons and executing the Click method?