protected void gvChecklist_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Footer) { DropDownList cmbStatus = (DropDownList)e.Row.FindControl("cmbStatus"); cmbStatus.DataSource = vrmdb.Get_Status(); cmbStatus.DataTextField = "status"; cmbStatus.DataValueField = "status"; cmbStatus.DataBind(); } if (e.Row.RowType == DataControlRowType.DataRow) { DropDownList cmbNewStatus = (DropDownList)e.Row.FindControl("cmbNewStatus"); if (cmbNewStatus != null) { cmbNewStatus.DataSource = vrmdb.Get_Status(); cmbNewStatus.DataTextField = "status"; cmbNewStatus.DataValueField = "status"; cmbNewStatus.DataBind(); cmbNewStatus.SelectedValue = gvChecklist.DataKeys[e.Row.RowIndex].Values[1].ToString(); }; } } protected void gvChecklist_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Footer) { DropDownList cmbStatus = (DropDownList)e.Row.FindControl("cmbStatus"); cmbStatus.DataSource = vrmdb.Get_Status(); cmbStatus.DataTextField = "status"; cmbStatus.DataValueField = "status"; cmbStatus.DataBind(); } if (e.Row.RowType == DataControlRowType.DataRow) { DropDownList cmbNewStatus = (DropDownList)e.Row.FindControl("cmbNewStatus"); if (cmbNewStatus != null) { cmbNewStatus.DataSource = vrmdb.Get_Status(); cmbNewStatus.DataTextField = "status"; cmbNewStatus.DataValueField = "status"; cmbNewStatus.DataBind(); cmbNewStatus.SelectedValue = gvChecklist.DataKeys[e.Row.RowIndex].Values[1].ToString(); }; } }
Server Error in '/VRM_WebSite' Application. Index was out of range. Must be non-negative and less than the size of the collection.Parameter name: index Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.Parameter name: indexSource Error: Line 417: cmbNewStatus.DataValueField = "status"; Line 418: cmbNewStatus.DataBind(); Line 419: cmbNewStatus.SelectedValue = gvChecklist.DataKeys[e.Row.RowIndex].Values[1].ToString(); Line 420: }; Line 421: }Source File: c:\Users\L31410\Desktop\Peggie\Peggie\Deployment Source\Phase 1\Deployment 25 Nov for StarHub\VS Projects Source\VRM_WebSite\app\vrm\ContractThreeGridView.aspx.cs Line: 419 Stack Trace:
Line 417: cmbNewStatus.DataValueField = "status"; Line 418: cmbNewStatus.DataBind(); Line 419: cmbNewStatus.SelectedValue = gvChecklist.DataKeys[e.Row.RowIndex].Values[1].ToString(); Line 420: }; Line 421: }