首页 新闻 会员 周边 捐助

请问这是什么原因?

0
[已关闭问题] 关闭于 2015-08-13 13:51


 编译器错误消息: CS1061: 'GridView' does not contain a definition for 'BottomPagerRow' and no extension method 'BottomPagerRow' accepting a first argument of type 'GridView' could be found (are you missing a using directive or an assembly reference?)

我已经在html中定义了

前台代码:

 <asp:GridView ID="GridView1" runat="server" AllowPaging="True"
        OnPageIndexChanging="gvwDesignationName_PageIndexChanging"
        AutoGenerateColumns="False" AllowSorting="True" 
            onselectedindexchanged="GridView1_SelectedIndexChanged">

后台就是获取不到

  protected void gvwDesignationName_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        // 得到该控件
        GridView theGrid = sender as GridView;
        int newPageIndex = 0;
        if (e.NewPageIndex == -3)
        {
            //点击了Go按钮
            TextBox txtNewPageIndex = null;

            //GridView较DataGrid提供了更多的API,获取分页块可以使用BottomPagerRow 或者TopPagerRow,当然还增加了HeaderRow和FooterRow
            GridViewRow pagerRow = theGrid.BottomPagerRow;

            if (pagerRow != null)
            {
                //得到text控件
                txtNewPageIndex = pagerRow.FindControl("txtNewPageIndex") as TextBox;
            }
            if (txtNewPageIndex != null)
            {
                //得到索引
                newPageIndex = int.Parse(txtNewPageIndex.Text) - 1;
            }
        }
        else
        {
            //点击了其他的按钮
            newPageIndex = e.NewPageIndex;
        }
        //防止新索引溢出
        newPageIndex = newPageIndex < 0 ? 0 : newPageIndex;
        newPageIndex = newPageIndex >= theGrid.PageCount ? theGrid.PageCount - 1 : newPageIndex;

        //得到新的值
        theGrid.PageIndex = newPageIndex;

        //重新绑定
        GridViewFill();
    }
小坡子~的主页 小坡子~ | 菜鸟二级 | 园豆:252
提问于:2013-07-30 01:26
< >
分享
所有回答(2)
0

BottomPagerRow在哪定义的?

dudu | 园豆:30939 (高人七级) | 2013-07-30 12:02
0

直接写出GridViewRow pagerRow = theGrid.BottomPagerRow;进行测试,也进行了null值的测试,发现没有错误的;会不会是其他地方的错误呢~~

Elaine00 | 园豆:294 (菜鸟二级) | 2013-07-31 17:14
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册