protected void OnRowUpdating(object sender, GridViewUpdateEventArgs e) { GridViewRow row = GridView_supplier.Rows[e.RowIndex]; string suppcode = Convert.ToString(GridView_supplier.DataKeys[e.RowIndex].Values[0]); string suppname = (row.FindControl("TextBox1") as TextBox).Text; string contacttitle = (row.FindControl("TextBox2") as TextBox).Text; string contactname = (row.FindControl("TextBox3") as TextBox).Text; string phone = (row.FindControl("TextBox4") as TextBox).Text; string fax = (row.FindControl("TextBox5") as TextBox).Text; string address = (row.FindControl("TextBox6") as TextBox).Text; string postcode = (row.FindControl("TextBox7") as TextBox).Text; string gst = (row.FindControl("TextBox8") as TextBox).Text; Suppliercode = suppcode; List <string> list = new List <string>() { suppcode, suppname, contacttitle, contactname, phone, fax, address, postcode, gst, }; foreach (string c in list) { if (c == "" || c == null) { Session["count"] = 1; } } if (Convert.ToInt32(Session["count"]) == 1) { Label10.Text = "Infomation is not complete"; Session["count"] = 0; } else { StoreBusinessLogic.EditSupplier(suppcode, suppname, contacttitle, contactname, phone, fax, address, postcode, gst); GridView_supplier.EditIndex = -1; bindgrid(); btn_InformSupplier.Enabled = true; Btn_addNew.Enabled = true; } }