我正在使用示例martijn Boland 的页面。
当我点击页码时,我的应用程序的 url 会发生变化:
http://localhost:1202/Issue?page=6
到现在为止还挺好。
问题是当我添加一个提交更改的下拉列表时,我无法分页和过滤。
如果我更改我的下拉列表,我应该在查询字符串中传递 projectId,我的部分视图将刷新并显示我过滤的记录。
现在,当我分页时,过滤器参数不会粘在查询字符串中,并且下拉列表中的选择也不会粘住。
我如何分页和过滤?
索引.aspx
<form id="form-post-project-selection" class="post-comments" method="get">
<label for="Country">Project:</label>
<%= Html.DropDownList("ProjectList", "--All--") %>
</form>
<% Html.RenderPartial("MyIssues", Model); %>
<script type="text/javascript">
$("#form-post-project-selection").submit(function(evt) {
var frm = $("#form-post-project-selection");
var action = frm.attr("action");
var serializedForm = frm.serialize();
var projectId = jQuery.trim($("ProjectList").val());
if (projectId.length < 1 || projectId == "-1")
return;
});
$("#ProjectList").change(function() {
$("#form-post-project-selection").submit();
});
</script>