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 7952783
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T02:57:47+00:00 2026-06-04T02:57:47+00:00

I am attempting to use the remote data annotation for the first time in

  • 0

I am attempting to use the remote data annotation for the first time in MVC 3.
I am missing something simple. The setup is not firing the controller action at all and I’m not seeing the issue off hand.

I am attempting to validate username for uniqueness.

Here is the code setup.

View Code

@Html.Raw(Html.Script("jquery.validate.min.js"))
@Html.Raw(Html.Script("jquery.validate.unobtrusive.min.js"))

<tr>
            <td class="editor-label">@Html.LabelFor(model => model.UserName):</td>
            <td  class="editor-field">@Html.EditorFor(model => model.UserName)</td>
            <td>@Html.ValidationMessageFor(model => model.UserName)</td>
        </tr>

ViewModel Code

    [DisplayName("Username")]
    [StringLength(100)]
    [Remote("CheckIfUsernameExists", "UserProfile", ErrorMessage = "This username is taken. Please enter a different user name.")]
    public string UserName { get; set; }

Controller Code

[HttpGet]
        public JsonResult CheckIfUsernameExists(string userName)
        {
            return Json("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-06-04T02:57:48+00:00Added an answer on June 4, 2026 at 2:57 am

    Check you setting, the client validation and the unobtrusive should be enabled

    <appSettings>
        <add key="ClientValidationEnabled" value="true" />
        <add key="UnobtrusiveJavaScriptEnabled" value="true" />
      </appSettings>
    

    with that the following code should work

        [Get]
        public JsonResult CheckIfUsernameExists(string userName)
        {
            return Json(false,JsonRequestBehavior.AllowGet);
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Attempting to use the data series from this example no longer passes the JSONLint
I am attempting to use the code-behind (Page_Load or PreRender) to set a date-time
I'm attempting to use Ramaze, the ruby framework, to implement a RESTful controller. I
I am currently attempting to use Lucene to search data populated in an index.
I'm attempting to use Paramiko (Python SSH library) to read a remote file, and
I am attempting to use Popen to automate a simple telnet session. In python
I am attempting to use a remote service to populate an autocomplete field that
I'm attempting to use selenium to automate some browser-based data entry. The target URL
I'm currently attempting to use the Windows Powerpack DataRepeater control to display data from
I am trying to make the default ASP.NET MVC application use a remote Oracle

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.