I am using Visual Studios 2017. I am making a webpage in ASP.NET.
I have a database that I bind to a gridview. I have dropdowns above for filtering the gridview, which so far has worked fine.
I have the rows selectable, so that if you click the select cell, it loads a second page with info from that particular row.
It works fine when the gridview is unfiltered, but as soon as I run a filter and then select a row, it gives me the original row info instead of the row that is now there.
So if the original row 5 becomes row 1 after filtering (and the original row 1 is now hidden) when I click the row, I still get the info from the original row one instead of what is technically row 5 (but is now in row 1 because of the filtering)
I believe the error is here:
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
GridViewRow row = GridView1.SelectedRow;
variables.spellCarry = row.RowIndex;
Response.Redirect("spellSpecific.aspx");
}
I've read elsewhere that I may need to use the key instead of the RowIndex, but am unclear how or if that is even the correct solution.