Why does Partial View show as full page in MVC 5 Visual Studio 13?

后端 未结 4 1217
春和景丽
春和景丽 2021-01-02 05:59

I\'m trying to replace part of a page with a partial view in ASP.Net MVC 5 (Visual Studio 13) using the following:

Views/Book/Index.cshtml:

4条回答
  •  臣服心动
    2021-01-02 06:31

    As an additional note on getting this working. I'm hoping VS 2013 RTM includes this but either way this should get you up and running

    • Install jquery-validate via nuget by going to tools-library package manager->package manager console and entering in
    install-package Microsoft.jQuery.Ajax.Unobtrusive
    
    • Configure your bundle in your /app_start/bundleconfig.cs
    bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
        "~/Scripts/jquery.unobtrusive*",
        "~/Scripts/jquery.validate*")
    );
    
    • Add your bundle to your _layout.cshtml either beneath your
    @Scripts.Render("~/bundles/jquery")

    or include it in each view you want to use it in

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

提交回复
热议问题