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

  • SEARCH
  • Home
  • 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 7858079
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T21:15:52+00:00 2026-06-02T21:15:52+00:00

I have the following code: <td colspan=5 align=left valign=top> <div style=position:absolute; >@Html.TextBoxFor(a => a.Item1.Username,

  • 0

I have the following code:

    <td colspan="5" align="left" valign="top">
        <div style="position:absolute;" >@Html.TextBoxFor(a => a.Item1.Username, new { @class = "textboxLarge" })
         @Html.ValidationMessageFor(a => a.Item1.Username)</div>
    </td>

And:

    public JsonResult IsUserNameAvailable(string Username)
    {
        var users = _userService.GetAll();
        var userNames = (from u in users
                        select u.Username).ToList();
        if (userNames.Contains(Username))
        {
            var referrer = Request.UrlReferrer.AbsolutePath;
            List<string> pagesToValidate = new List<string>() { "Registro" };
            var jsonRequestBehavior = JsonRequestBehavior.DenyGet;
            foreach (string page in pagesToValidate)
            {
                if (referrer.Contains(page))
                    jsonRequestBehavior = JsonRequestBehavior.AllowGet;
            }
            return Json("El nombre de usuario ya existe.", jsonRequestBehavior);
        }
        return Json(true, JsonRequestBehavior.AllowGet);
    }

Basically, the Username field calls the IsUsernameAvailable method. The validation fires and the method is called but the variable “Username” has a null value every time so the validation is always true.
Any ideas?

EDIT:
This is the Username field

    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Username", DbType="NVarChar(50) NOT NULL", CanBeNull=false)]
    [Required(ErrorMessage="El nombre de usuario es requerido.")]
    [Remote("IsUserNameAvailable", "Validation")]
    public string Username
    {
        get
        {
            return this._Username;
        }
        set
        {
            if ((this._Username != value))
            {
                this.OnUsernameChanging(value);
                this.SendPropertyChanging();
                this._Username = value;
                this.SendPropertyChanged("Username");
                this.OnUsernameChanged();
            }
        }
    }
  • 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-02T21:15:54+00:00Added an answer on June 2, 2026 at 9:15 pm

    Did you try specifying a prefix:

    public ActionResult IsUserNameAvailable([Bind(Prefix="Item1")] string username)
    {
        ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following code in html: <div> <div style=float:left;margin:0.5em> <span class=title>Label1</span><br/> <input type=text name=name1
I have the following php code: echo <div style='float:left;'>; echo <table>; echo <tr>; echo
I have the following code: <td colspan=7height=200 valign=top> <iframe id=myframe name=myframe src=index.php?page=1 width=810 height=100
I have the following code: HTML <table width=30% border=0> <tr> <td colspan=4 align=center> <asp:Label
I have following code of HTML, <table> <tr> <td>content</td> <td>content</td> </tr> <tr> <td colspan=2>one</td>
i have following code to show div on page <div id=all_users> <div id=user11 userid=11
I have following code in a html form <select name=category class=input onchange=ShowTB(this,'suggest');> <option value=0
I have the following code, but it doesn't put the scrolling div anywhere. All
Say you have a webpage with following sample code: <tr class=even> <td>something1</td> <td colspan=1>somthing1.1</td>
I have the following chunk of HTML code but i cant figure how i

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.