0

I try to make user registation form. I have two user types and want to make two JQuery UI tabs with forms. But tab is empty and in java script console error "GET http://localhost/ParcDocs/Admin/Users/AddWorker 500 (Internal Server Error)".

Code of user registration page:

 <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 code:

@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>
}

Controller code:

public ActionResult AddWorker()
        {
            var model = new WorkerUser();
            return PartialView(model);
        }

Same behavior this second tab.

1 Answer 1

1

You should be returning a PartialViewResult, rather than an ActionResult. Put a breakpoint on public ActionResult AddWorker() and see what exception you get. Paste it here so that we have more information.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.