required attribute not working in asp.net mvc

前端 未结 6 1541
离开以前
离开以前 2020-12-03 19:53

I have a simple strongly-typed view.

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


        
6条回答
  •  抹茶落季
    2020-12-03 20:51

    For the record, you can include the following code at the end of your view, to make sure that the [Required] attribute pops up in the user interface:

    @section Scripts {
        @Scripts.Render("~/bundles/jqueryval")
    }
    

提交回复
热议问题