【问题标题】:Last page and First page Gives Exception in MVC paging最后一页和第一页在 MVC 分页中给出异常
【发布时间】:2016-08-10 04:51:10
【问题描述】:
 protected void gvValues_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            gvValues.PageIndex = e.NewPageIndex;
            this.FillData();
        }

分页工作正常,但是当我在 last 或 First 上单击时,它给了我 Error as

Input string was not in a correct format.

【问题讨论】:

  • 好的,我做到了,我还应该怎么做?我试图让开关循环正确地制作索引,但我不知道我应该把这个循环放在哪里
  • 你能看看我的回答吗?

标签: asp.net gridview paging


【解决方案1】:

编写以下代码:

protected void gvValues_PageIndexChanging(object sender, GridViewPageEventArgs e){

    GridView1.PageIndex = e.NewPageIndex;

    //rebind your gridview - GetSource(),Datasource of your GirdView
    GridView1.DataSource = GetSource();
    GridView1.DataBind();

}

【讨论】:

  • 我将它绑定在我的原始代码中,看看我更新的问题,我的分页在 123456 中正常工作......但是当我按下最后一页时,它给了我这个异常
猜你喜欢
  • 2018-01-24
  • 1970-01-01
  • 1970-01-01
  • 2021-06-06
  • 2020-07-10
  • 1970-01-01
  • 2020-10-26
  • 2021-05-14
  • 2018-01-19
相关资源
最近更新 更多