Index out of range, but why?
- by Stuart
I have a gridview, and i have a SelectedIndexChanged event on it...
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
GridViewRow Row = GridView1.SelectedRow;
//do some stuff
}
Then i get an error...
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
I dont understand why, the Gridview is being binded in pageload. but not in post back...
if (!IsPostBack)
{
GridView1.DataSource = UserAccounts;
GridView1.DataBind();
}