protected void cvUserName_ServerValidate(object source, ServerValidateEventArgs args) { if (Session["legacyusersDT"] != null) { legacyusersDT = (dsCompany.legacyusersDataTable)(Session["legacyusersDT"]); if (legacyusersDT[0].UserName != args.Value) { dsCompanyTableAdapters.legacyusersTableAdapter legacyusersTA = new dsCompanyTableAdapters.legacyusersTableAdapter(); dsCompany.legacyusersDataTable legacyusersDTCheck = new dsCompany.legacyusersDataTable(); legacyusersDTCheck = legacyusersTA.GetCompanyByUserName(args.Value); if (legacyusersDTCheck.Rows.Count > 0) { args.IsValid = false; } else { args.IsValid = true; } } else { args.IsValid = true; } } }
protected void cvUserName_ServerValidate(object source, ServerValidateEventArgs args) { dsCompanyTableAdapters.legacyusersTableAdapter legacyusersTA = new dsCompanyTableAdapters.legacyusersTableAdapter(); dsCompany.legacyusersDataTable legacyusersDT = new dsCompany.legacyusersDataTable(); legacyusersDT = legacyusersTA.GetCompanyByUserName(args.Value); if (legacyusersDT.Rows.Count > 0) { args.IsValid = false; } else { args.IsValid = true; } }