【发布时间】:2016-06-26 12:48:21
【问题描述】:
screen shot shows webgrid state after paging number clicked
分页工作,网格添加/更新/删除按预期工作。 Ajaxcontainer 工作正常,仅替换页面上的网格单击而不是整个页面替换为仅 webgrid。唯一的问题是网格模式被折叠了?我在哪里失踪。
局部视图
<div id="gridposition" style="overflow: scroll; height: 300px; overflow-x: hidden;">
<a href="javascript://" id="btnAddNew">Add New(+)</a>
@{
var grid = new WebGrid(source: Model, canPage: true, defaultSort: "QuestionID", rowsPerPage: 3, ajaxUpdateContainerId: "gridposition");
}
<div id="gridContent" style="padding-right: 30%;">
@grid.GetHtml(htmlAttributes: new { id = "result" },
tableStyle: "wGrid",
fillEmptyRows: false,
alternatingRowStyle: "alt",
headerStyle: "gridHeader",
mode: WebGridPagerModes.All,
firstText: "<< First",
previousText: " < Previous",
nextText: "Next >",
lastText: "Last >>",
emptyRowCellValue: null,
columns:
grid.Columns( ....
部分视图包含网格按钮单击事件的脚本以及这一行
$('.edit-mode').hide();
主视图
var url = '@Url.Action("Filter","AddSurveyQuestions")';
$.get(url, { campaignid: campaignid, languagename: languagename }, function (result) {
$('#SurveyViewGrid').html(result);
}); ....
主视图调用局部视图
<div id="SurveyViewGrid">
@Html.Partial("SurveyView", Model.SurveyQuestions)
</div>
【问题讨论】:
标签: javascript jquery asp.net-mvc-3 webgrid