erforderliches Attribut funktioniert nicht im asp.net mvc

Habe ich eine einfache stark-typisierte Ansicht.

@model GoldForGold.Models.LogonModel
@{
    ViewBag.Title = "Logins";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

Logins
@using (Html.BeginForm()) {

Account Information
@Html.LabelFor(m => m.UserName)
@Html.TextBoxFor(m => m.UserName, new { id = "txtUserName" })
@Html.ValidationMessageFor(m => m.UserName)
@Html.LabelFor(m => m.Password)
@Html.PasswordFor(m => m.Password, new { id = "txtPassword" })
@Html.ValidationMessageFor(m => m.Password)
@Html.CheckBoxFor(m => m.RememberMe)
@Html.LabelFor(m => m.RememberMe)

<input type="submit" value="Log On" onclick="getcredentials()" />
}

Modell-code ist hier.

public class LogonModel
{
    [Required(ErrorMessage="please enter username")]
    [Display(Name = "User name")]
    public string UserName { get; set; }

    [Required]
    [DataType(DataType.Password)]
    [Display(Name = "Password")]
    public string Password { get; set; }

    [Display(Name = "Remember me?")]
    public bool RememberMe { get; set; }
}

Ich nichts sehe passiert auch, wenn ich nicht geben Sie einen Benutzernamen und ein Passwort.

Können Sie zeigen Sie uns Ihre Post-action-Methode.

InformationsquelleAutor user2465036 | 2013-11-01

Schreibe einen Kommentar