2014-04-15 45 views
0

我試圖剃刀添加到我的HTML,但現在我得到一個分析器錯誤,不明白爲什麼我得到這個錯誤:獲取分析器錯誤時,將剃刀HTML

HTML:

@model ServingTeam.DAL.Members 
@{ 
    ViewBag.Title = "New Member"; 
    Layout = "~/Views/Shared/_Layout.cshtml"; 
} 
@using (Html.BeginForm("AddMember", "Home", new { ReturnUrl = ViewBag.ReturnUrl }, FormMethod.Post, new { role = "form" })) 
{ 
<div class="row"> 
    <div class="col-md-2"> 
    </div> 
    <div class="col-sm-6"> 
     <h2> 
      New Member</h2> 
     <form class="form-horizontal" role="form" id="memberForm"> 
     <div class="form-group"> 
      <label for="inputName" class="col-sm-2 control-label" /> 
      Name</label> 
      <div class="col-sm-10"> 
       @Html.TextBoxFor(m => m.Email, new { @class = "form-control", placeholder = "Name", type = "text", required = "required " }) 
      </div> 
     </div> 
     <div class="form-group"> 
      <label for="inputName" class="col-sm-2 control-label"> 
       Surname</label> 
      <div class="col-sm-10"> 
       @Html.TextBoxFor(m => m.Surname, new { @class = "form-control", placeholder = "Surname", type = "text", required = "required " }) 
      </div> 
     </div> 
     <div class="form-group"> 
      <label for="inputName" class="col-sm-2 control-label"> 
       Cell</label> 
      <div class="col-sm-10"> 
       @Html.TextBoxFor(m => m.Cell, new { @class = "form-control", placeholder = "Cell", type = "text" }) 
      </div> 
     </div> 
     <div class="form-group"> 
      <label for="inputEmail3" class="col-sm-2 control-label"> 
       Email</label> 
      <div class="col-sm-10"> 
       @Html.TextBoxFor(m => m.Email, new { @class = "form-control", placeholder = "Enter email address", type = "email", required = "required " }) 
      </div> 
     </div> 
     <div class="form-group"> 
      <div class="col-sm-offset-2 col-sm-10"> 
       <button type="submit" class="btn btn-info"> 
        Submit</button> 
      </div> 
     </div> 
     </form> 

    </div> 
    <div class="col-md-4"> 
    </div> 
</div> 
} 

@section Scripts { 
    @Scripts.Render("~/bundles/jqueryval") 
} 
<script> 
    $("#memberForm").validate(); 
</script> 

這是我得到的錯誤: 遭遇結束標記「div」,沒有匹配的開始標記。您的開始/結束標籤是否適當平衡?所有工作正常,當我刪除剃刀。

請幫忙嗎?

+0

你確定錯誤不在佈局文件中嗎? – thsorens

+0

即使使用Razor,我的其他網頁也不會有問題 – Gericke

回答

1

我在你的標記中發現了一個錯誤,不知道它是否與你當前的錯誤有關。

<form class="form-horizontal" role="form" id="memberForm"> 
</form> 

的使用(Html.BeginForm)實際上將創建一個表單你,現在你有表單內的形式,這是不wizely

<label for="inputName" class="col-sm-2 control-label" /> 
     Name</label> 

你去那裏。該標籤被取消兩次。

+0

我有另一個頁面,裏面有一個使用(Html.Form)的窗體,它完美的工作。這就是我不明白爲什麼我得到這個錯誤的原因。 – Gericke

+0

Did not say it would not work,just said it was wizely;) – thsorens

+0

在您的標記中添加新的錯字 – thsorens