title: Specified argument was out of the range of valid values.Parameter name: value
body: <p>When I am deleting a row from grid view I am getting following error. "Specified argument was out of the range of valid values.Parameter name: value ".
  The following is the Stack Trace: </p>
  
  <pre><code>[ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
  Parameter name: value]
     System.Web.UI.WebControls.GridView.set_SelectedIndex(Int32 value) +1353411
     System.Web.UI.WebControls.GridView.HandleDeleteCallback(Int32 affectedRows, Exception ex) +368
     System.Web.UI.DataSourceView.Delete(IDictionary keys, IDictionary oldValues, DataSourceViewOperationCallback callback) +137
     System.Web.UI.WebControls.GridView.HandleDelete(GridViewRow row, Int32 rowIndex) +714
     System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +869
     System.Web.UI.WebControls.GridView.OnBubbleEvent(Object source, EventArgs e) +95
     System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
     System.Web.UI.WebControls.GridViewRow.OnBubbleEvent(Object source, EventArgs e) +123
     System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
     System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +118
     System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +135
     System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
     System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
     System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +175
     System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565
  </code></pre>
  
  <p>Please suggest me.</p>
  
  <p>No. I didnt set set any index manually.My code sample as follows:                                                                   
                  
                      
                          
                              
                          
                      
                      
                          
                              '>
                          
                      
                      
                          
                              ' >
                          
                      </p>
  
  <pre><code>            &lt;/Columns&gt;
          &lt;/asp:GridView&gt;
          &lt;asp:SqlDataSource ID="srcData" runat="server" ConnectionString="&lt;%$ ConnectionStrings:GermanyCockpitDB %&gt;"
              SelectCommand="SP_BPGetData" SelectCommandType="StoredProcedure"
              OnSelecting="srcBP_Selecting" DeleteCommand="SP_BPDeleteRecord"
              DeleteCommandType="StoredProcedure" OnDeleting="srcData_deleting"&gt;
              &lt;SelectParameters&gt;
                  &lt;asp:Parameter Name="Manager" Type="String" /&gt;
                  &lt;asp:Parameter Name="Period1" Type="String" /&gt;
                  &lt;asp:Parameter Name="Period2" Type="String" /&gt;
                  &lt;asp:Parameter Name="Period3" Type="String" /&gt;
                  &lt;asp:Parameter Name="Period4" Type="String" /&gt;
              &lt;/SelectParameters&gt;
              &lt;DeleteParameters&gt;
                  &lt;asp:Parameter Name="ManagerName" Type="String" /&gt;
                  &lt;asp:Parameter Name="Name" Type="String" /&gt;
                  &lt;asp:Parameter Name="AName" Type="String" /&gt;
              &lt;/DeleteParameters&gt;
          &lt;/asp:SqlDataSource&gt;&lt;br /&gt;&lt;br /&gt;  protected void Page_Load(object sender, EventArgs e)
  {
      if (!IsPostBack)
      {
          gvData.DataSourceID = "srcData";
          gvData.DataBind();
      }
  
  }protected void srcData_deleting(object sender, SqlDataSourceCommandEventArgs e)
  {
      e.Command.Parameters["@ManagerName"].Value = "Sample";
  }
  
  protected void srcBP_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
  {
      e.Command.Parameters["@ReportsToManager"].Value = "Sample";
      e.Command.Parameters["@Period1"].Value = "0";
      e.Command.Parameters["@Period2"].Value = "1";
      e.Command.Parameters["@Period3"].Value = "2";
      e.Command.Parameters["@Period4"].Value = "3";
  }
  </code></pre>