Best approach for extending unobtrusive javascript in MVC3 to add a style to a div client side

后端 未结 7 856
情话喂你
情话喂你 2021-01-31 03:50

I\'m using html5/Razor/MVC3 leveraging the Bootstrap template from Twitter. I want to have form validation that looks slick like they\'ve documented (http://twitter.github.com/b

7条回答
  •  太阳男子
    2021-01-31 04:09

    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)

    With this solution, it will most likely be enough to just add a javascript without edit the View.

提交回复
热议问题