在我的程序中,我试图在按钮点击时动态添加额外的控件。是否可以使用EditorTemplates? 这是我的EditorTemplates
@model chPayroll.Models.HREducation.HRInfo
@{
var list = (IEnumerable<SelectListItem>)TempData["PassedDivision"];
var list1 = (IEnumerable<SelectListItem>)TempData["Country"];
}
@Html.HiddenFor(x => x.StaffId)
<tr>
<td>@Html.DropDownListFor(x => x.Country, list1, "-select-")</td>
<td>@Html.TextBoxFor(x=>x.Board)</td>
<td>@Html.TextBoxFor(x=>x.Level)</td>
<td>@Html.TextBoxFor(x=>x.PassedYr)</td>
<td>@Html.DropDownListFor(x=>x.PassedDivision,list,"-selected-")</td>
<td><input type="file" name="file"></td>
</tr>
现在我想在按钮点击时动态添加所有控件。 我从视图中打电话给上市人。
@model chPayroll.Models.HREducation.HRInfo
<div align="left">
<fieldset style="left:0px">
@using (Html.BeginForm("Addcontrols", "HREduInformation", FormMethod.Post))
{
<table >
<tr>
<th >Country</th>
<th>Board</th>
<th>Level</th>
<th>Passed Year</th>
<th>Division</th>
<th>certificate</th>
</tr>
@Html.EditorFor(m => m.listInfoeditor)
</table>
<input type="submit" value="Add New" id="savechanges" />
}
</fieldset>
</div
答案 0 :(得分:0)