当webgrid_partial
调用如下时,看到结果没有问题并且可以更改页面(Ajax):
<div id="AjaxGridContent">
@{
@Html.Partial("_PartialUserWebGrid", Model.IEUser)
}
</div>
但是当从jQuery调用更新webgrid_partial
时,只能看到包含其他页面链接的第一页,但是当选择其他页面链接<div>
标记为空(空白)时!没有结果也无法访问webgrid!
我的jQuery函数:
function callpartial() {
$.ajax({
type: 'POST',
url: "/Home/SearchInfo",
data: JSON.stringify({ txtFirstName: "", txtLastName: "" }),
contentType: 'application/json; charset=utf-8',
dataType: "html",
success: function (result) {
$("#imgLoading").hide();
$('#AjaxGridContent').html(result);
},
error: function (result) {
alert("error")
}
});
return;
};
我的网页设置:
@{
var grid = new WebGrid(
source: Model,
defaultSort: "Id",
rowsPerPage: 5,
canPage: true,
canSort: true,
selectionFieldName: "SelectedRow",
ajaxUpdateContainerId: "usergrid"
);
}
@grid.GetHtml(
htmlAttributes: new { id = "usergrid" },...other col prop.
“SearchInfo”动作:
public PartialViewResult SearchInfo(string txtLastName)
{
var model = BlUser.Select().Where(p => p.LastName.Contains(txtLastName)).ToList();
return PartialView("_PartialUserWebGrid", model);
}
我该如何解决这个问题?!