Error in Update function
<p>I created this datagrid in my .aspx file.</p>

<pre><code>&lt;asp:datagrid id="Computerchange" runat="server" AllowPaging="True" PageSize="2" AutoGenerateColumns="False" BorderColor="Gainsboro" Height="500px"&gt;
    &lt;Columns&gt;
        &lt;asp:EditCommandColumn ButtonType="LinkButton" UpdateText="Update" HeaderText="Admin Functions" CancelText="Cancel" EditText="Edit"&gt;&lt;/asp:EditCommandColumn&gt;
        &lt;asp:ButtonColumn Text="Delete" HeaderText="Delete" CommandName="Delete"&gt;&lt;/asp:ButtonColumn&gt;
        &lt;asp:BoundColumn DataField="com_id" ReadOnly="True" HeaderText="Computer Number"&gt;&lt;/asp:BoundColumn&gt;
        &lt;asp:BoundColumn DataField="company" HeaderText="Company"&gt;&lt;/asp:BoundColumn&gt;
        &lt;asp:BoundColumn DataField="price" HeaderText="Price"&gt;&lt;/asp:BoundColumn&gt;
        &lt;asp:BoundColumn DataField="model" HeaderText="Model"&gt;&lt;/asp:BoundColumn&gt;
        &lt;asp:BoundColumn DataField="description" HeaderText="Description"&gt;&lt;/asp:BoundColumn&gt;
        &lt;asp:BoundColumn DataField="id" ReadOnly="True" HeaderText="Category"&gt;&lt;/asp:BoundColumn&gt;
        &lt;asp:BoundColumn DataField="quantity" ReadOnly="False" HeaderText="Quantity"&gt;&lt;/asp:BoundColumn&gt;
        &lt;asp:BoundColumn DataField="imgSrc" HeaderText="Image"&gt;&lt;/asp:BoundColumn&gt;
    &lt;/Columns&gt;
&lt;/asp:datagrid&gt;
</code></pre>

<p>With this datagrid I want to edit-delete-update these columns in my database. When I have <code>ReadOnly="False"</code> in the quantity column then it works fine. I can Edit-Delete-Update everything. Sometimes I want to edit all the columns except QUANTITY. But when I convert it to <code>True</code>, then I have the following error when I click the Update button</p>

<blockquote>
  <p>Specified argument was out of the range of valid values. Parameter name: index</p>
  
  <p>Stack Trace:</p>
  
  <p>[ArgumentOutOfRangeException: Specified argument was out of the range of valid values. Parameter name: index]</p>
  
  <p>System.Web.UI.ControlCollection.get_Item(Int32 index) +8750274
  AdminMainPage.Computerchange_UpdateCommand(Object source, DataGridCommandEventArgs e) +626
  System.Web.UI.WebControls.DataGrid.OnUpdateCommand(DataGridCommandEventArgs e) +115
  System.Web.UI.WebControls.DataGrid.OnBubbleEvent(Object source, EventArgs e) +498
  System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
  System.Web.UI.WebControls.DataGridItem.OnBubbleEvent(Object source, EventArgs e) +121
  System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
  System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +125
  System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +169</p>
  
  <p>System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +9
  System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
  System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +176
  System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563</p>
</blockquote>

<p>Do you know why I have this error and what can I do to fix it? I wrote this function for the update Command</p>

<pre><code>private void Computerchange_UpdateCommand(object source, 
System.Web.UI.WebControls.DataGridCommandEventArgs e)   
{
    //Store updated column values in local variables:

    //string updateCOM_ID = e.Item.Cells["com_id"].Text;

    string updateCOM_ID = e.Item.Cells[2].Text;

    string updateCompany = ((TextBox)e.Item.Cells[3].Controls[0]).Text;

    double updatePrice = double.Parse(((TextBox)e.Item.Cells[4].Controls[0]).Text);

    string updateModel = ((TextBox)e.Item.Cells[5].Controls[0]).Text;

    string updateDescription = ((TextBox)e.Item.Cells[6].Controls[0]).Text;

    int updateCategoryId = int.Parse(e.Item.Cells[7].Text);

    string updateImage = ((TextBox)e.Item.Cells[9].Controls[0]).Text;

    string updateQuantity = ((TextBox)e.Item.Cells[8].Controls[0]).Text;

    newView.RowFilter = "com_id='" + updateCOM_ID + "'";

    if (newView.Count &gt; 0)
    {
        //Delete the row that is being updated

        newView.Delete(0);
    }

    newView.RowFilter = "";

    //Create a new DataRow and populate it with the new data.

    DataRow Row = Table.NewRow();

    Row["com_id"] = updateCOM_ID;

    Row["company"] = updateCompany;

    Row["price"] = updatePrice;

    Row["model"] = updateModel;

    Row["description"] = updateDescription;

    Row["id"] = updateCategoryId;

    Row["imgSrc"] = updateImage;

    //Row["quantity"] = updateQuantity;

    //Insert the new DataRow:

    Table.Rows.Add(Row);

    Computerchange.EditItemIndex = -1;

    Computerchange.DataSource = newView;

    Computerchange.DataBind();

    // Now update the database with the new data

    adminCentral1.adminCentral newData = new adminCentral1.adminCentral();

    string results;

    results = newData.updateItem(updateCOM_ID, updateCompany, updatePrice, updateModel, updateDescription, updateImage, updateCategoryId, updateQuantity);

    if (results == "Success")
    {
        errorLabel.Text = "Computer Updated to database!";
    }
    else
    {
        errorLabel.Text = results;
    }
</code></pre>
