protected void txtAddressName_TextChanged(object sender, EventArgs e) { if (editid.Value == "") { DataTable dt = objAddressM.GetAddressDataByAddressName(StrCompId, txtAddressName.Text); if (dt.Rows.Count > 0) { txtAddressName.Text = ""; DisplayMessage("Address Name Already Exists"); System.Web.UI.ScriptManager.GetCurrent(this).SetFocus(txtAddressName); return; } DataTable dt1 = objAddressM.GetAddressFalseAllData(StrCompId); dt1 = new DataView(dt1, "Address_Name='" + txtAddressName.Text + "'", "", DataViewRowState.CurrentRows).ToTable(); if (dt1.Rows.Count > 0) { txtAddressName.Text = ""; DisplayMessage("Address Name Already Exists - Go to Bin Tab"); System.Web.UI.ScriptManager.GetCurrent(this).SetFocus(txtAddressName); return; } } else { DataTable dtTemp = objAddressM.GetAddressDataByTransId(editid.Value, StrCompId); if (dtTemp.Rows.Count > 0) { if (dtTemp.Rows[0]["Address_Name"].ToString() != txtAddressName.Text) { DataTable dt = objAddressM.GetAddressDataByAddressName(StrCompId, txtAddressName.Text); if (dt.Rows.Count > 0) { txtAddressName.Text = ""; DisplayMessage("Address Name Already Exists"); System.Web.UI.ScriptManager.GetCurrent(this).SetFocus(txtAddressName); return; } DataTable dt1 = objAddressM.GetAddressFalseAllData(StrCompId); dt1 = new DataView(dt1, "Address_Name='" + txtAddressName.Text + "'", "", DataViewRowState.CurrentRows).ToTable(); if (dt1.Rows.Count > 0) { txtAddressName.Text = ""; DisplayMessage("Address Name Already Exists - Go to Bin Tab"); System.Web.UI.ScriptManager.GetCurrent(this).SetFocus(txtAddressName); return; } } } } System.Web.UI.ScriptManager.GetCurrent(this).SetFocus(txtAddress); }
protected void txtAddressNameNew_TextChanged(object sender, EventArgs e) { DataTable dt = AM.GetAddressDataByAddressName(Session["CompId"].ToString(), txtAddressNameNew.Text); if (dt.Rows.Count > 0) { txtAddressNameNew.Text = ""; DisplayMessage("Address Name Already Exists"); System.Web.UI.ScriptManager.GetCurrent(this).SetFocus(txtAddressNameNew); return; } DataTable dt1 = AM.GetAddressFalseAllData(Session["CompId"].ToString()); dt1 = new DataView(dt1, "Address_Name='" + txtAddressNameNew.Text + "'", "", DataViewRowState.CurrentRows).ToTable(); if (dt1.Rows.Count > 0) { txtAddressNameNew.Text = ""; DisplayMessage("Address Name Already In Deleted Section"); System.Web.UI.ScriptManager.GetCurrent(this).SetFocus(txtAddressNameNew); return; } System.Web.UI.ScriptManager.GetCurrent(this).SetFocus(txtAddress); }