动态数据 Web 应用程序未分页至第 2 页

发布于 2024-11-06 21:00:09 字数 89 浏览 4 评论 0原文

我创建了一个动态数据 Web 应用程序,当我有多个页面时,我可以导航到第二页和最后一页,但是我无法导航到第二页和最后一页之间的任何页面... .有什么想法或建议吗?

I have created a Dynamic Data Web Application and when I have more then one page I am able to navigate to the second page and the last page however I am unable to navigate to any of the pages in between two and the last page....any ideas or suggestions?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

你是年少的欢喜 2024-11-13 21:00:09

我遇到了同样的问题,就我而言,这是由过滤器损坏引起的。

我创建了一个文本框过滤器,在开发过程中,为了简单起见,我无意中在 FilterControl 的 Page_Load 事件中添加了 OnFilterChanged(); 。后来,当我将其复制到 TextChanged 事件中时,它就变得过时了,因为前一种方法存在故障。

不幸的是,在List.aspx.cs中,有以下代码:

protected void DynamicFilter_FilterChanged(object sender, EventArgs e)
{
    GridView1.PageIndex = 0;
}

结果,在每次页面加载时,GridView的PageIndex都会被重置。由于 Page_Load 在下一页按钮的事件处理程序之前的 DynamicFilter_FilterChanged 之前被调用,因此结果将是:

在任何具有多个页面的列表页面上:

  • 单击下一个,无论当前 < code>PageIndex 导航至第 2 页
  • 单击上一页 当前 PageIndex 导航至第 1 页
  • 其他导航控件按预期工作,包括输入页码。

为了解决这个问题,我刚刚从过滤器中的 Page_Load 中删除了 OnFilterChanged();

您可能需要检查每个第三方过滤器。或者,您可以注释掉 DynamicFilter_FilterChanged 事件来查看过滤器是否是罪魁祸首。

I encountered the same problem, and in my case, it was caused by broken filters.

I created a Textbox filter, and during development, I unwittingly added OnFilterChanged(); in the FilterControl's Page_Load event for the sake of simplicity. Later, it was rendered obsolete as I copied it into the TextChanged event, as the former method has glitches.

Unfortunately, in List.aspx.cs, there lies the following code:

protected void DynamicFilter_FilterChanged(object sender, EventArgs e)
{
    GridView1.PageIndex = 0;
}

As a result, at every page load, the PageIndex of GridView is reset. And since Page_Load is called before DynamicFilter_FilterChanged before the next page button's event handler, the result will be:

On any list page with more than one page:

  • Clicking next whatever the current PageIndex navigates to page 2
  • Clicking previous whatever the current PageIndex navigates to page 1
  • Other navigation controls work as intended, including entering the page number.

To solve the problem, I just removed OnFilterChanged(); from Page_Load in the filter.

You may need to check every third-party filter. Or, you may comment out the DynamicFilter_FilterChanged event to see if filters are to blame.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文