【问题标题】:layout is not included in all pages in asp.net mvc4 application布局未包含在 asp.net mvc4 应用程序的所有页面中
【发布时间】:2014-06-01 15:23:26
【问题描述】:

我正在使用 Bootstrap 3 开发一个 asp.net mvc4 应用程序,我在“Shared”文件夹中有 _Layout.cshtml,在 Views 中,我有两个页面,“Index”和“Register”,我已经将 Layout 包含在这两个视图,但似乎布局仅包含在“索引”中,而不包含在“注册”视图中。以下是我的索引和注册视图

@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2 align="center" class="bg-info">Login</h2>
<form class="form-horizontal" role="form">
  <div class="form-group">
    <label for="inputEmail3" class="col-sm-2 control-label"><strong>UserName : </strong></label>
    <div class="col-sm-10">
      <input type="email" class="form-control" id="inputEmail3" placeholder="UserName">
    </div>
  </div>
  <div class="form-group">
    <label for="inputPassword3" class="col-sm-2 control-label"><strong>Password</strong></label>
    <div class="col-sm-10">
      <input type="password" class="form-control" id="inputPassword3" placeholder="Password">
    </div>
  </div>
  <div class="form-group">
    <div class="col-sm-offset-2 col-sm-10">
      <div class="checkbox">
        <label>
          <input type="checkbox"> Remember me
        </label>
      </div>
    </div>
  </div>
  <div class="form-group">
    <div class="col-sm-offset-2 col-sm-10">
      <button  type="submit" class="btn btn-primary">Sign in</button>

    </div>
  </div>
    <h2 align="center" class="bg-info">SignIn With Other Services</h2>
</form>
   <form  class="form-horizontal" role="form" method="post" action="/Home/FacebookLogin">
       <div class="form-group">
    <div class="col-sm-offset-2 col-sm-10">
      <button type="submit" class="btn btn-primary">SignIn with Facebook</button>

    </div>
  </div>
   </form>
 <h2 align="center" class="bg-info">Don't Have an Account?</h2>

   <form  class="form-horizontal" role="form" method="post" action="/Home/Register">
       <div class="form-group">
    <div class="col-sm-offset-2 col-sm-10">
      <button type="submit" class="btn btn-primary">Register</button>

    </div>
  </div>
   </form>

![@{
    ViewBag.Title = "Register";
    Layout = "~/Views/Shared/_Layout.cshtml";

}

<h2 align="center" class="bg-info">Register</h2>
<form class="form-horizontal" role="form">
  <div class="form-group">
    <label for="inputEmail3" class="col-sm-2 control-label"><strong>UserName : </strong></label>
    <div class="col-sm-10">
      <input type="email" class="form-control" id="uname" name="uname" placeholder="UserName">
      <input type="button" class="btn btn-primary" id="check" value="Check Availability" >
        <h4  class="bg-warning"></h4>

    </div>
  </div>
  <div class="form-group">
    <label for="inputPassword3" class="col-sm-2 control-label"><strong>Password</strong></label>
    <div class="col-sm-10">
      <input type="password" class="form-control" id="upass" name="upass" placeholder="Password">
    </div>
  </div>
     <div class="form-group">
    <label for="inputPassword3" class="col-sm-2 control-label"><strong>Retype Password</strong></label>
    <div class="col-sm-10">
      <input type="password" class="form-control" id="retype" placeholder="Password">
    </div>
  </div>

  <div class="form-group">
    <div class="col-sm-offset-2 col-sm-10">
      <button  type="submit" class="btn btn-primary">Register</button>

    </div>
  </div>
</form>]

【问题讨论】:

    标签: asp.net-mvc-4 layout twitter-bootstrap-3


    【解决方案1】:
    猜你喜欢
    • 2012-04-29
    • 1970-01-01
    • 1970-01-01
    • 2021-07-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-06-05
    相关资源
    最近更新 更多