System.ArgumentOutOfRangeException:
-
Error Specified argument was out of the range of valid values. Parameter name: index while i'm loading the page, error will come in this code protected void grdEncounter_RowDataBound(object o, GridViewRowEventArgs e) { GridViewRow grdEditRow = e.Row; if (grdEditRow.RowType.Equals(DataControlRowType.Header)) return; grdEditRow.Cells[2].Text = grdEditRow.Cells[2].Text.Equals("1") ? "Yes" : "No"; //error comes under above line } thanks in advance
-
Error Specified argument was out of the range of valid values. Parameter name: index while i'm loading the page, error will come in this code protected void grdEncounter_RowDataBound(object o, GridViewRowEventArgs e) { GridViewRow grdEditRow = e.Row; if (grdEditRow.RowType.Equals(DataControlRowType.Header)) return; grdEditRow.Cells[2].Text = grdEditRow.Cells[2].Text.Equals("1") ? "Yes" : "No"; //error comes under above line } thanks in advance
kankeyan wrote:
Specified argument was out of the range of valid values. Parameter name: index
kankeyan wrote:
grdEditRow.Cells[2].Text = grdEditRow.Cells[2].
It looks like you're trying to access the 3rd cell (zero based index) which doesn't exist as the error message says. set a breakpoint on that line and examine the cells Count property.
Dave
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) -
Error Specified argument was out of the range of valid values. Parameter name: index while i'm loading the page, error will come in this code protected void grdEncounter_RowDataBound(object o, GridViewRowEventArgs e) { GridViewRow grdEditRow = e.Row; if (grdEditRow.RowType.Equals(DataControlRowType.Header)) return; grdEditRow.Cells[2].Text = grdEditRow.Cells[2].Text.Equals("1") ? "Yes" : "No"; //error comes under above line } thanks in advance