谁能告诉我这里会发生什么?我有两个项目,都使用RazorMVC,并且都在.cshtml文件中使用相同的完全代码,但是没有输出<form>
标记:
<div id="attachmentAddFormArea" class="waitingOverlayParent">
@using (Html.BeginForm("AddAttachment", "Attachment", FormMethod.Post, new { id = "attachmentAddForm", @class = "form-horizontal", role = "form", enctype = "multipart/form-data" }))
{
<div class="row form-group">
<label for="inputFile" class="col-sm-2 col-lg-2 control-label">Select File</label>
<div class="col-sm-7 col-lg-7">
<div class="btn btn-default btn-file">
Select<input type="file" id="inputFile" name="fileData" />
</div>
<input type="text" class="form-control btn-file-text" readonly />
<button type="button" id="attachmentSubmitBtn" class="btn btn-file-submit" name="Submit">Upload</button>
</div>
</div>
<div class="row form-group">
<label for="@Html.IdFor(x => x.Description)" class="col-sm-2 col-lg-2 control-label">@Html.LabelFor(x => x.Description)</label>
<div class="col-sm-8 col-lg-8">
@Html.TextAreaFor(x => Model.Description, 5, 40, new { placeholder = "Enter Description", @class = "form-control" })
@Html.ValidationMessageFor(x => x.Description)
</div>
</div>
}
</div>
在非功能版中,这是输出:
<div id="attachmentAddFormArea" class="waitingOverlayParent">
<div class="row form-group">
<label for="inputFile" class="col-sm-2 col-lg-2 control-label">Select File</label>
<div class="col-sm-7 col-lg-7">
<div class="btn btn-default btn-file">
Select<input type="file" id="inputFile" name="fileData">
</div>
<input type="text" class="form-control btn-file-text" readonly="">
<button type="button" id="attachmentSubmitBtn" class="btn btn-file-submit" name="Submit">Upload</button>
</div>
</div>
<div class="row form-group">
<label for="Description" class="col-sm-2 col-lg-2 control-label"><label for="Description">Description</label></label>
<div class="col-sm-8 col-lg-8">
<textarea class="form-control" cols="40" id="Description" name="Description" placeholder="Enter Description" rows="5"></textarea>
<span class="field-validation-valid" data-valmsg-for="Description" data-valmsg-replace="true"></span>
</div>
</div>
</div>
HELP! :)