public void updatelogic() { try { if (hd.Value != "true") { lblcheckDoubleError.Text = String.Empty; GridViewRow row = GridView1.SelectedRow; int batch_id = Convert.ToInt32(ViewState["batchid"].ToString()); context.sp_Updatebatch(companyId, batch_id, branchId, txtBatchName.Text, User_id, DateTime.Today); btnUpdate.Visible = false; btnSave.Visible = true; loadDataTable(); divalert.Visible = true; lblAlert.Text = "Updated Successfully"; txtBatchName.Text = string.Empty; } else { divalert.Visible = false; lblcheckDoubleError.ForeColor = System.Drawing.Color.Red; lblcheckDoubleError.Text = "This Batch name already Exists"; } } catch (Exception ex) { ErrorLog.saveerror(ex); //Do Logging } }