Apply Twitter Bootstrap Validation Style and Message to ASP.NET MVC validation

前端 未结 12 1637
星月不相逢
星月不相逢 2021-01-30 00:57

How can I integrate ASP.NET MVC unobtrusive validation and Twitter Bootstrap? I want to have all those validation messages and styles appropria

12条回答
  •  猫巷女王i
    2021-01-30 01:55

    You can integrate MVC3 validation with Bootstrap framework by adding the following javascript to your page (View)

    
    

    Besides, on the Views (for example "Create.cshtml") make sure that the fields in the form are formatted as the following...

        
    @Html.LabelFor(Function(model) model.Name)
    @Html.EditorFor(Function(model) model.Name) @Html.ValidationMessageFor(Function(model) model.Name)

提交回复
热议问题