【发布时间】:2014-01-14 20:04:54
【问题描述】:
我有这个代码
[AcceptVerbs(HttpVerbs.Get)]
public ActionResult ManageEmployee(int cntID, string command)
{
repository = new ContactRepository();
if (!String.IsNullOrEmpty(command) && command.Equals("edit"))
{
LKIContact employees = repository.GetById(cntID);
ViewBag.IsUpdate = true;
return PartialView("_ManageEmployee", employees);
}
else
{
ViewBag.IsUpdate = false;
return PartialView("_ManageEmployee");
}
}
当我点击时:
<a href='Home/ManageEmployee?cntID=${cntID}&command=edit' class='editDialog'>Edit</a>
我执行上述方法的第一部分以显示我填充的表单以进行更新
当我点击href='Home/ManageEmployee?cntID=0&command=create' class='openDialog' 时,我会打开空表单来添加新员工。
我现在的问题是,当我点击编辑或创建时,我得到了想要的结果,但在另一个页面中。我想要的是在特定的 div 中滑出这些表单(如下),同时保持在同一页面上。(在网格下)
<div id="dialog-edit"></div>
<div id="dialog-create" style="display: none"></div>
这里是我的网格将被加载的代码以及我希望我的表单被加载的 div 的位置
@section featured {
<section class="featured">
<div class="content-wrapper">
<!-- the igHierarchicalGrid target element-->
<table id="employeeGrid" style="width: auto;"></table>
<p>
<!--<a id='openDialog' href='Home/CreateEmployee?cntID=0' class='openDialog ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only' style="color: white;"><button>Add Employee</button></a>-->
</p>
</div>
</section>
<br />
<div id="dialog-confirm" style="display: none">
<p>
<span class="ui-icon ui-icon-alert" style="float: left; margin: 0 7px 20px 0;"></span>
Are you sure to delete ?
</p>
</div>
<div id="dialog-edit"></div>
<div id="dialog-view" style="display: none"></div>
}
感谢您的帮助
【问题讨论】:
-
查看api.jquery.com/load 从服务器获取 HTML 并将其填充到 DOM 中。
标签: c# jquery asp.net asp.net-mvc razor