protected void txtClassName_TextChanged(object sender, EventArgs e) { if (editid.Value == "") { DataTable dt = objDesg.GetClassMasterByClassName(Session["CompId"].ToString().ToString(), txtClassName.Text.Trim()); if (dt.Rows.Count > 0) { txtClassName.Text = ""; DisplayMessage("Class Name Already Exists"); System.Web.UI.ScriptManager.GetCurrent(this).SetFocus(txtClassName); return; } DataTable dt1 = objDesg.GetClassMasterInactive(Session["CompId"].ToString().ToString()); dt1 = new DataView(dt1, "Class='" + txtClassName.Text + "'", "", DataViewRowState.CurrentRows).ToTable(); if (dt1.Rows.Count > 0) { txtClassName.Text = ""; DisplayMessage("Class Name Already Exists - Go to Bin Tab"); System.Web.UI.ScriptManager.GetCurrent(this).SetFocus(txtClassName); return; } txtClassNameL.Focus(); } else { DataTable dtTemp = objDesg.GetClassMasterById(Session["CompId"].ToString().ToString(), editid.Value); if (dtTemp.Rows.Count > 0) { if (dtTemp.Rows[0]["Class"].ToString() != txtClassName.Text) { DataTable dt = objDesg.GetClassMaster(Session["CompId"].ToString().ToString()); dt = new DataView(dt, "Class='" + txtClassName.Text + "'", "", DataViewRowState.CurrentRows).ToTable(); if (dt.Rows.Count > 0) { txtClassName.Text = ""; DisplayMessage("Class Name Already Exists"); System.Web.UI.ScriptManager.GetCurrent(this).SetFocus(txtClassName); return; } DataTable dt1 = objDesg.GetClassMasterInactive(Session["CompId"].ToString().ToString()); dt1 = new DataView(dt1, "Class='" + txtClassName.Text + "'", "", DataViewRowState.CurrentRows).ToTable(); if (dt1.Rows.Count > 0) { txtClassName.Text = ""; DisplayMessage("Class Name Already Exists - Go to Bin Tab"); System.Web.UI.ScriptManager.GetCurrent(this).SetFocus(txtClassName); return; } } } txtClassNameL.Focus(); } }