When I select an employee from the dropdownlist instead of keeping me on the main page it takes me to a new blank page for the partial view. I want the partial view to remain on the main page. My _Layout page also has these jquery files.
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/jqueryui")
@Scripts.Render("~/bundles/jqueryval")
@Scripts.Render("~/bundles/bootstrap")
这是My Dashboard控制器的代码
public ActionResult ManagerAssignedTask(ManagerAssignedTasksFilterViewModel assignedTasksFilterViewModel, GridSortOptions gridSortOptions, int page = 1)
{
gridSortOptions.Column = (gridSortOptions.Column == "undefined") ? null : gridSortOptions.Column;
var employeeTasks = this._serviceSession.EmployeeTaskRepository.FilterEmployeeTasks(assignedTasksFilterViewModel.EmployeeId)
.OrderBy(gridSortOptions.Column ?? "CaseId", gridSortOptions.Direction)
.AsPagination(page, PageSize);
this.ViewBag.FundingConsultants = EmployeeHelper.FindFundingConsultants(this._masterDataSession, new RoleProvider());
foreach (var task in employeeTasks)
{
task.AssignedBy = task.AssignedBy ?? "UNKNOWN";
task.Description = task.Description.Truncate(70);
task.EndUser= task.EndUser ?? "UNKNOWN";
}
this.ViewBag.Header = "Assigned Task";
return PartialView("_ManagerAssignedTaskList", new GridViewModel<EmployeeTask> { Items = employeeTasks, GridSortOptions = gridSortOptions });
}
_ManagerAssignedTasksList 这是视图的代码
@using System.Web.Optimization
@using MvcContrib
@using OMI.Web.Extensions
@model OMI.Web.ViewModels.GridViewModel<OMI.Data.Model.EmployeeTask>
<h3>@ViewBag.Header</h3>
@Html.Partial("_ManagerAssignedTasksFilterBox", new OMI.Web.ViewModels.Dashboard.ManagerAssignedTasksFilterViewModel())
@Html.Grid(Model.Items, 1).Sort(Model.GridSortOptions).RowAttributes(row => new Hash(@class => row.Item.DateDue < DateTime.Now ? "assignTaskRowColor" : "")).Columns(columns =>
{
columns.For(c => Html.ActionLink(c.CaseId.ToString(), "Details", "Case", new { id = c.CaseId }, null)).Named("Case Id").SortColumnName("CaseId");
columns.For(c => c.EndUser).Named("End User").SortColumnName("EndUser");
columns.For(c => c.StateProvince).Named("State").SortColumnName("StateProvince");
columns.For(c => Html.ActionLink(c.EmployeeTaskId.ToString(), "Details", "EmployeeTask", new { employeeTaskId = c.EmployeeTaskId }, null)).Named("Task Id").SortColumnName("EmployeeTaskId");
columns.For(c => c.AssignedBy).Named("Assigned By").SortColumnName("AssignedBy");
columns.For(c => c.DateDue).Format("{0:M/d/yyyy}").Named("Due Date").SortColumnName("DateDue");
columns.For(c => c.Description).Named("Description").SortColumnName("Description");
columns.For(c => @Html.Raw("<a title='Done' class='btn btn-mini btn-success' href='#' onclick = 'markTaskAsComplete(" + c.EmployeeId + "," + c.EmployeeTaskId) + "," + c.CaseId + ")'><i class='icon-ok icon-white'></i></a> ").Encode(false).SortColumnName("").Visible(false);
})
@Html.Raw(Html.Pager(Model.Items).ToString())
这是我的部分视图代码-_ManagerAssignedTasksFilterBox
@using OMI.Web.Extensions
@model OMI.Web.ViewModels.Dashboard.ManagerAssignedTasksFilterViewModel
<div class="well">
<h3>SEARCH EMPLOYEE</h3>
@using (Html.BeginForm("ManagerAssignedTask", "Dashboard", FormMethod.Get, new { @class = "form-inline", id = "employeeDropDown", target="_self"}))
{
@Html.DropDownListFor(m => m.EmployeeId, new SelectList(ViewBag.FundingConsultants,"Value","Text"), new { onchange = "$('#employeeDropDown').submit()" })
}
</div>
有谁知道导致这个问题的原因是什么?