Textbox In gridview not saving its value in table
<p>I have a gridview <code>gv_Products</code> and a gridview <code>Gv_selected</code>. My products gridview has a checkbox that when is checked the selected row is entered in the <code>gv_selected</code> gridview.<br>
I have added a textbox in <code>gv_selected</code> gridiew to enter the quantity i want to reorder. The quantity that i enter loses its value after i press the submit button.</p>

<pre><code>&lt;asp:GridView ID="gvSelected" runat="server" 
    AutoGenerateColumns = "False" Font-Names = "Arial" CssClass="gridviewsSmall" Font-Size = "11pt" 
    OnRowDataBound="GridView_gvSelected_RowDataBound" EnableViewState="False"                                    
    EmptyDataText = "No Records Selected"  &gt;
        &lt;Columns&gt;
         &lt;asp:BoundField DataField="ProductId" HeaderText="Product ID" ReadOnly="True" 
            SortExpression="ProductId" /&gt;
        &lt;asp:TemplateField HeaderText="Product No" SortExpression="ProductNo"&gt;
            &lt;ItemTemplate&gt;
                &lt;asp:Label ID="Label2" runat="server" Text='&lt;%# Bind("ProductNo") %&gt;'&gt;&lt;/asp:Label&gt;
            &lt;/ItemTemplate&gt;
        &lt;/asp:TemplateField&gt;
        &lt;asp:TemplateField HeaderText="Product Name" SortExpression="Product_name"&gt;
            &lt;ItemTemplate&gt;
                &lt;asp:Label ID="Label3" runat="server" Text='&lt;%# Bind("Product_name") %&gt;'&gt;&lt;/asp:Label&gt;
            &lt;/ItemTemplate&gt;
        &lt;/asp:TemplateField&gt;
         &lt;asp:BoundField DataField="SupplierId" HeaderText="Supplier ID" ReadOnly="True" 
            SortExpression="SupplierId" /&gt;
            &lt;asp:TemplateField HeaderText="Quantity" SortExpression="Quantity"&gt;
                &lt;ItemTemplate&gt;
                    &lt;asp:TextBox ID="TextBox1" runat="server"  Text='&lt;%#Bind("Quantity") %&gt;'&gt;&lt;/asp:TextBox&gt;
                &lt;/ItemTemplate&gt;
            &lt;/asp:TemplateField&gt;
 &lt;/Columns&gt;  
 &lt;/asp:GridView&gt;
 &lt;asp:Button ID="btnSendOrder" Visible="false" runat="server" Text="Send Order" 
onclick="btnSendOrder_Click" /&gt;
</code></pre>

<p>Here is my code behind for adding rows in gvSelected gridview</p>

<pre><code>       private DataTable CreateDataTable()
    {
        DataTable dt = new DataTable();
        dt.Columns.Add("ProductId");
        dt.Columns.Add("ProductNo");
        dt.Columns.Add("Product_name");
        dt.Columns.Add("SupplierId");
        dt.Columns.Add("Quantity");

        dt.AcceptChanges();
        return dt;
    }

    private DataTable AddRow(GridViewRow gvRow, DataTable dt)
    {

        DataRow[] dr = dt.Select("ProductId = '" + gvRow.Cells[3].Text + "'");
        if (dr.Length &lt;= 0)
        {
            dt.Rows.Add();
            dt.Rows[dt.Rows.Count - 1]["ProductId"] = gvRow.Cells[3].Text;
            dt.Rows[dt.Rows.Count - 1]["ProductNo"] = (gvRow.FindControl("Label2") as Label).Text;
            dt.Rows[dt.Rows.Count - 1]["Product_name"] = (gvRow.FindControl("Label3") as Label).Text;
            dt.Rows[dt.Rows.Count - 1]["SupplierId"] = (gvRow.FindControl("Label5") as Label).Text;
            dt.Rows[dt.Rows.Count - 1]["Quantity"] = 0;
            dt.AcceptChanges();
        }
        return dt;
    }

    protected void CheckBox_CheckChanged(object sender, EventArgs e)
    {
        GetData();
        SetData();
        BindSecondaryGrid();

    }

    private void BindSecondaryGrid()
    {
        DataTable dt = (DataTable)ViewState["SelectedRecords"];
        gvSelected.DataSource = dt;
        gvSelected.DataBind();
    }
</code></pre>

<p>And here is the submit button!</p>

<pre><code>protected void btnSendOrder_Click(object sender, EventArgs e)
    {

        t_supplier_orders newOrder = new t_supplier_orders();

        newOrder.UserName = User.Identity.Name;
        newOrder.Order_date = DateTime.Now;


        newOrder.Order_status = "Pending";
        MembershipUser myObject = Membership.GetUser();
        Guid UserID = new Guid(myObject.ProviderUserKey.ToString());
        newOrder.UserId = UserID;
        newOrder.SupplierId = Convert.ToInt32(ddl1.SelectedValue);
        newOrder.Received_date = null;


        Bohemian.t_supplier_orders.AddObject(newOrder);
        Bohemian.SaveChanges();


        //------------------------------------------------------------------------+
        //  Create a new OderDetail Record for each item in the gvSelected     |
        //------------------------------------------------------------------------+

        foreach (GridViewRow row in gvSelected.Rows)
        {

            {
                t_supplier_orders_details od = new t_supplier_orders_details();

                     TextBox txt1 = (TextBox)gvSelected.FindControl("TextBox1");

                    od.OrderId = newOrder.OrderId;
                    od.ProductId = Convert.ToInt32(row.Cells[0].Text);
                    od.Product_name = (row.FindControl("Label3") as Label).Text;
                    od.ProductNo = (row.FindControl("Label2") as Label).Text;

                    od.Quantity = Convert.ToInt32(txt1.text);

                    Bohemian.t_supplier_orders_details.AddObject(od);

            }
        }

       Bohemian.SaveChanges();
       lblSuccess.Text = "The Order has been successfully sent to supplier!!";
        lblSuccess.ForeColor=System.Drawing.Color.BlueViolet;
        lblSuccess.Font.Bold = true;

    }
</code></pre>
