Quantity textbox in Add to cart in ASP.net using gridview
<p>I have a problem regarding with my Add to cart. I shown my products in gridview and get the data (ProductName, ProductPrice, ProductImage ) from sqlserver through LinqDataSource. Then i add a  Command Button "AddToCart" to get this products. Iuse this code and it's working:</p>

<pre><code> protected void GridViewProduct_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "AddToCart")
        {
            int RowClicked = Convert.ToInt32(e.CommandArgument);
            int ProductID = Convert.ToInt32(GridViewProduct.DataKeys[RowClicked].Value);
            List&lt;int&gt; ProductsInCart = (List&lt;int&gt;)Session["Cart"];
            if (ProductsInCart == null)
            {
                ProductsInCart = new List&lt;int&gt;();
            }
            ProductsInCart.Add(ProductID);
            Session["Cart"] = ProductsInCart;
        }
    }
</code></pre>

<p>I succesfully get all the orders and show it in my checkout.aspx with this ocde:</p>

<pre><code>   using System;
   using System.Collections.Generic;
   using System.Linq;
   using System.Web;
   using System.Web.UI;
   using System.Web.UI.WebControls;

  namespace SmartMethodStore
  {
    public partial class checkout : System.Web.UI.Page
    {
    protected void Page_Load(object sender, EventArgs e)
    {


        if (!Page.IsPostBack)
        {
            GetProductsFromCart();
        }
        else
        {
            ButtonContinueToPayment.Visible = false;
        }
    }

    protected void GridViewProduct_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "RemoveFromCart")
        {
            int RowClicked = Convert.ToInt32(e.CommandArgument);
            int ProductID = Convert.ToInt32(GridViewProduct.DataKeys[RowClicked].Value);
            List&lt;int&gt; ProductsInCart = (List&lt;int&gt;)Session["Cart"];
            ProductsInCart.Remove(ProductID);
            Session["Cart"] = ProductsInCart;
            GetProductsFromCart();
        }
    }

    private void GetProductsFromCart()
    {
        if (Session["Cart"] != null)
        {

            using (StoreDataContext Data = new StoreDataContext())
            {
                List&lt;int&gt; Cart = (List&lt;int&gt;)Session["Cart"];
                var Products = Data.Products.Where(Product =&gt; Cart.Contains(Product.ProductID));
                GridViewProduct.DataSource = Products;
                GridViewProduct.DataBind();
            }

        }

    }

    protected void ButtonContinueToPayment_Click(object sender, EventArgs e)
    {
        if (Page.User.Identity.IsAuthenticated)
        {
            using (StoreDataContext Data = new StoreDataContext())
            {
                decimal total = 0;
                DateTime now = DateTime.Now;
                DateTime due = now.AddDays(3); 

                OrderInfo NewOrder = new OrderInfo();
                NewOrder.DueDate = due;
                NewOrder.OrderPaid = "Unpaid";
                NewOrder.OrderDate = DateTime.Now;
                NewOrder.OrderSent = "Pending";
                NewOrder.UserName = Page.User.Identity.Name;

                Data.OrderInfos.InsertOnSubmit(NewOrder);
                Data.SubmitChanges();



                List&lt;int&gt; Products = (List&lt;int&gt;)Session["Cart"];

                foreach (int ProductID in Products)

                {
                    Product p  = Data.Products.Single(Product =&gt; (Product.ProductID == @ProductID));

                        OrderProduct NewOrderProduct = new OrderProduct();


                        NewOrderProduct.OrderID = NewOrder.OrderID;
                        NewOrderProduct.ProductID = ProductID;
                        NewOrderProduct.OrderProductQuantity = 1;
                        NewOrderProduct.OrderProductValue = p.ProductPrice;
                        NewOrderProduct.OrderedDate=DateTime.Now;

                        Data.OrderProducts.InsertOnSubmit(NewOrderProduct);
                        Data.SubmitChanges();
                        total = total + p.ProductPrice;


                }

                NewOrder.TotalCost = total;
                Data.SubmitChanges();
                Response.Redirect("~/pay/pay.aspx");

                if (TextBoxComment.Text == null)
                {
                    Response.Redirect("~/pay/");
                }
                else
                   // using (StoreDataContext Data = new StoreDataContext())
                    {
                        Comment com = new Comment();

                        com.CommentMessage = TextBoxComment.Text;
                        com.CommentDate = DateTime.Now;
                        Data.Comments.InsertOnSubmit(com);
                        Data.SubmitChanges();
                        TextBoxComment.Text = " ";

                    }
            }
        }
        else
        {
            Response.Redirect("~/pay/pay.aspx");
        }
    }


}
</code></pre>

<p>}</p>

<p>My problem now is How am i going to put a quantity textbox and get the value of that at the same time im getting the value of ProductImage,ProductPrice,ProductName. I tried putting txtQuantity (Textbox) in my gridview but i cant get the value of it. So i dont have a choice of quantity in my add to cart. please help me thanks. </p>
