private void updatecode() { try { if (hd.Value != "true") { lblcheckDoubleError.Text = String.Empty; //GridViewRow row = GridView1.SelectedRow; int rack_id = Convert.ToInt32(hdrack.Value); int godown_id = Convert.ToInt32(ddlGodownName.SelectedValue); //decimal TaxPercent = decimal.Parse(txtTaxPercent.Text); context.sp_UpdateRack(companyId, branchId, rack_id, godown_id, txtRackName.Text, User_id, DateTime.Today); divalert.Visible = true; lblAlert.Text = "Rack Updated Successfully"; ViewState["gridrow"] = 0; clr(); ((Rack)this.Page).loadDataTable(); } else { divalert.Visible = false; lblcheckDoubleError.ForeColor = System.Drawing.Color.Red; lblcheckDoubleError.Text = "This Rack name already Exists"; return; } } catch (Exception ex) { ErrorLog.saveerror(ex); //Do Logging } }