Update Visual Studio 2017 MVC View Scaffolding to Bootstrap 4

前端 未结 3 1911
余生分开走
余生分开走 2021-01-04 18:10

I\'ve just updated my Visual Studio 2017 ASP.NET MVC 5 application from Bootstrap v3 to v4. I\'m finding when I add a new edit partial view using scaffolding, it is still us

3条回答
  •  滥情空心
    2021-01-04 18:49

    To fix/update the ASP .NET MVC 5 project navbar to Bootstrap 4 you have to update your code manually as follows:

    • Views -> Shared -> _Layout.cshtml.

    Then if you don’t use the Login partial, you can remove it. Otherwise, change the _LoginPartial.cshtml to:

    @using Microsoft.AspNet.Identity
    @if (Request.IsAuthenticated)
    {
      using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "logoutForm" }))
      {
      @Html.AntiForgeryToken()
      
      }
    }
    else
    {
      
    }

    And last just remove the next lines from Content/Site.css:

    /*delete this*/
    body {
        padding-top: 50px;
        padding-bottom: 20px;
    }

提交回复
热议问题