您好,当我尝试从 webgrid 中的一个页面导航到另一个页面时,我的 aspx 页面中有一个带有分页的 webgrid。我正在丢失 aspx 页面中其他控件的数据。基本上,当从一个页面导航到另一个页面时,webgrid 会尝试重新加载整个 aspx 页面。
我的问题是如何使这个 webgrid 在我的 aspx 页面中独立存在,并且在从一个页面移动到另一个页面时不重新加载页面
提前致谢
<html>
<head>
<title>Index</title>
<style type="text/css">
.webGrid { margin: 4px; border-collapse: collapse; width: 300px; }
.header { background-color: #E8E8E8; font-weight: bold; color: #FFF; }
.webGrid th, .webGrid td { border: 1px solid #C0C0C0; padding: 5px; }
.alt { background-color: #E8E8E8; color: #000; }
.person { width: 200px; font-weight:bold;}
</style>
</head>
<body>
@{
var grid = new WebGrid(Model, canPage: true, rowsPerPage: 5);
grid.Pager(WebGridPagerModes.NextPrevious);
@grid.GetHtml(tableStyle: "webGrid",
htmlAttributes: new { id = "DataTable" },
headerStyle: "header",
alternatingRowStyle: "alt",
columns: grid.Columns(
grid.Column("Age"),
grid.Column("Id"),
grid.Column("Name")
));
}
<input type="text" id="somed" /><select><option value="some">test1</option><option value="some2">test2</option><option value="some3">test3</option></select>
</body>
</html>
在这里我有一个文本框和一个下拉菜单,所以每当我尝试从一个页面导航到另一个页面时,文本框中的值和选定的下拉列表值都消失了。
最佳答案
经过几个小时的搜索,我找到了一个可以提供帮助的链接..
这是链接 http://haacked.com/archive/2009/04/14/using-jquery-grid-with-asp.net-mvc.aspx
关于asp.net-mvc - 在 aspx 页面中的 webgrid 中从一页导航到另一页时丢失 Web 控件数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10341484/