翻页事件

前端页面:

                 ID="l_CurrentPage" runat="server" Font-Size="10pt">
               

           
                首页
                前一页
                后一页
                末页
 

后端代码:

 #region ShowPage    GridView翻页事件
    protected void ShowPage(object sender, EventArgs e)
    {
        string arg = ((LinkButton)sender).CommandArgument.ToString();
        switch (arg)
        {
            case "first":
                { gv_Country.CurrentPageIndex = 0; }
                break;
            case "prev":
                if (gv_Country.CurrentPageIndex > 0)
                { gv_Country.CurrentPageIndex -= 1; }
                break;
            case "next":
                if (gv_Country.CurrentPageIndex < (gv_Country.PageCount - 1))
                { gv_Country.CurrentPageIndex += 1; }
                break;
            case "last":
                gv_Country.CurrentPageIndex = (gv_Country.PageCount - 1);
                break;
            default:
                return;
        }
        f_databind();
    }//ShowPage
    #endregion

你可能感兴趣的:(代码_用户界面,server,asp,object,string)