I have a gridview that show the whole list that the use click now want I click order it will insert to the database can this work???? I am sorry I am still learing and I mean not know any thing so please help me
for e.g my gridview have those
Items Cost Quantity
Toy $300 3
Bed $299 1
GrandTotal: $599
I want to store the all the item, cost and quantity that show in the gridview and even the greandtoal to store in the database can it work? (Notice the gridview can have many item so item).
If can how can I do this?
Loading
Posted Aug 4, 2013, 4:28 AM
foreach (GridViewRow GVRow in GridView1.Rows)
{
ItemName = GVRow.Cells[1].Text;
Qty = GVRow.Cells[2].Text;
Cost = GVRow.Cells[3].Text;
SqlConnection scn = new SqlConnection(GetConnectionString());
using(con)
{
SqlCommand scm = new SqlCommand();
scm.Connection = scn;
scm.CommandText = "YOUR SP NAME";
scm.CommandType = CommandType.StoredProcedure;
scm.Parameters.AddWithValue("@ItemName", ItemName.ToString());
scm.Parameters.AddWithValue("@Qty", Qty.ToString());
scm.Parameters.AddWithValue("@Cost", Cost.ToString());
scm.ExecuteNonQuery();
}
}
Iftikar HussainPosted Aug 4, 2013, 4:28 AM
http://net.tutsplus.com/tutorials/other/build-a-shopping-cart-in-aspnet/
http://www.codeproject.com/Articles/3765/Easy-ASP-NET-Shopping-Cart
Regards,
Iftikar
Tan Kai KaiPosted Aug 4, 2013, 3:49 AM
I have those item now and I have to add them to my SQL Database with all item that gridview is show
Mean that add a new row for all those item that user have select
You know normally how people do the shopping cart item to bring to payment page that what I looking To show what item that the user have click
Iftikar HussainPosted Aug 4, 2013, 3:42 AM
I think you are looking for editable gridview option. Please refer this link and let me know if it help you
http://www.codeproject.com/Articles/23471/Editable-GridView-in-ASP-NET-2-0
Regards,
Iftikar