Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 665045
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T23:40:01+00:00 2026-05-13T23:40:01+00:00

I tried to make ValidationAttribute which would check the database whether such an object.

  • 0

I tried to make ValidationAttribute which would check the database whether such an object.
And it even works only if you do not include <% Html.EnableClientValidation ();%>

Can Someone tells how to get to work through Ajax

public class UsernameBaseCheckAttribute : ValidationAttribute 
{
    SimplebdLinqDataContext db = new SimplebdLinqDataContext(); //DataContext(Linq)

    public override bool IsValid(object value)
    {


        if (!db.Users.Any(u => u.UserName == (string)value))
        {
            return true;

        }
        else
        {
            return false;
        }
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T23:40:01+00:00Added an answer on May 13, 2026 at 11:40 pm

    Check this out. I think you need to follow the instructions near the end where he creates the javascript function that will handle the client side validation. In your case, you will need to make an ajax call to determine if the input is valid because you need to check against your database.

    http://haacked.com/archive/2009/11/19/aspnetmvc2-custom-validation.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When using Fluent NHinbernate How do I make a PK Read only I tried
I tried to make use of some classes of com.sap.mw.jco.* , such as IRepository
I have tried (set (make-local-variable 'comment-auto-fill-only-comments) t) and also (auto-fill-mode 0) Though amazingly, neither
I recently tried to make a game server controller in Perl, I would like
I have tried to make a custom alert dialog and it mostly works very
Here I tried to make option menu, but menu is not displaying on screen,
So I tried to make a vector which elements are pairs of a struct
I tried to make the title as clear as possible... here is my scenario:
While creating a file synchronization program in C# I tried to make a method
I am tying to make comments in a blog engine XSS-safe. Tried a lot

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.