if (DropDownList1.Text == "Completed") { for (int i = 0; i <= GridView1.Rows.Count - 1; i++) { GridViewRow row = GridView1.Rows[i]; if (row.RowType == DataControlRowType.DataRow) { ShoppingCartItem item = new ShoppingCartItem(); item.ProductID = (int)GridView1.DataKeys[i].Value; //I am getting index out of range exception here.. item.Quantity = int.Parse(((Label)(row.FindControl("txtmainqty"))).Text); dbcon db1 = new dbcon(); int orderedQuantity = System.Convert.ToInt32(item.Quantity); string query1 = "update Products set productquantity=productquantity-'" + orderedQuantity + "' where ProductID='" + item.ProductID + "'"; //bool b = db.UDI(query); bool c = db1.UDI(query1); if (c == true) { // lblshow.Text = "Product Delivered and Added to DataBase Sucessfully"; } else { //lblshow.Text = " Operation Not successful"; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)