这是我的观点。
@using (Html.BeginForm("uploadimage",
"PatientDocumentsMain",
FormMethod.Post,
new { @Area = "PatientDocument", enctype =
"multipart/form-data" }))
{
<table cellspacing="0" cellpadding="0" class="table table-
striped">
<tr>
<td>
Document Name:<span class="spnError">*</span>
</td>
<td>
<input type="text" id="txtDocumentName" name="DocName"
class="required form-control" />
</td>
</tr>
<tr>
<td class="tdEditDoc">
<span>Document Type:</span><span class="spnError">*</span>
</td>
<td id="tdDocumentCategory">
@Html.DropDownList("ddlDocumentCategory", null, new { @id = "",
@onchange = "AddCategory();", @class =
"required form-control", @name= "DocType" })
</td>
</tr>
<tr>
<td class="tdEditDoc">
<span>Date:</span><span class="spnError">*</span>
</td>
<td>
<input type="text" id="txtPatientDocumentDate" class="Date
required IsDate form-control" name="DocDate" />
</td>
</tr>
<tr>
<td class="tdEditDoc" style="height: 25px;">
<span>Confidental:</span>
</td>
<td>
<input type="checkbox" id="chkPatientDocumentIsConfedential"
/>
</td>
</tr>
<tr>
<td class="tdEditDoc" style="vertical-align: top">
Comments:
</td>
<td>
<textarea id="txtPatientDocumentComments" name="comments"
style="margin-right: 15px; width: 245px; height: 69px;
border-width: 1px; border-color: #c4c4c4;resize:none"
class="form-control">
</textarea>
</td>
</tr>
</table>
<input type="file" name="file" id="file" title="Upload file(s)" />
}
我将此表单提交给此控制器
public void uploadimage(string DocName, string DocType, string DocDate, string d, string comments, HttpPostedFileBase file)
{
}
我正在获取除DropDown值以外的所有其他参数.Plus如何获取复选框的值(已选中或未选中)。我没有使用任何模型,想要没有它。
答案 0 :(得分:0)
使用空值下拉绑定?
@Html.DropDownList("ddlDocumentCategory", null, new { @id = "", @onchange = "AddCategory();", @class = "required form-control", @name= "DocType" })
还要确保输入字段的名称与字符串参数相同。
答案 1 :(得分:0)
第一个参数是字段名称
@Html.DropDownList("DocType", null, new { @id = "", @onchange = "AddCategory();", @class = "required form-control" })