0
我嘗試製作用戶註冊表單。我有兩個用戶類型,並希望使用表單創建兩個JQuery UI選項卡。但標籤是空的,並在Java腳本控制檯錯誤「GET http://localhost/ParcDocs/Admin/Users/AddWorker 500(內部服務器錯誤)」。在ASP.NET MVC 3中使用表單的JQuery UI選項卡
代碼用戶註冊頁面的:
<script type="text/javascript">
$(document).ready(function() {
$("#tabContainer").tabs();
});
</script>
<div id="tabContainer">
<ul>
<li>@Html.ActionLink("Пользователь", "AddUser", "Users", null, null)</li>
<li>@Html.ActionLink("Сотрудник", "AddWorker", "Users", null, null)</li>
</ul>
</div>
PartialView代碼:
@model ParcDocs.Models.WorkerUser
@using (Html.BeginForm("AddWorker", "Users"))
{
@Html.ValidationSummary(true)
<fieldset>
<legend>Пользователь</legend>
<div class="editor-label">
@Html.LabelFor(model => model.UserName)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.UserName)
@Html.ValidationMessageFor(model => model.UserName)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.Password)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.UserName)
@Html.ValidationMessageFor(model => model.Password)
</div>
<div class="editor-field">
@Html.DropDownListFor(model => model.RoleId, ((IEnumerable<ParcDocs.Models.Role>)ViewBag.PossibleRoles).Select(option => new SelectListItem
{
Text = (option == null ? "None" : option.Name),
Value = option.Id.ToString(),
Selected = (Model != null) && (option.Id == Model.RoleId)
}), "Выберете роль пользователя")
</div>
<p>
<input type="submit" value="Добавить" />
</p>
</fieldset>
}
控制器代碼:
public ActionResult AddWorker()
{
var model = new WorkerUser();
return PartialView(model);
}
相同的行爲這個第二個標籤。