我的前台代码
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"  
        CellPadding="4" ForeColor="#333333" GridLines="None" AllowPaging="True" 
        DataKeyNames="id" onrowdeleting="GridView1_RowDeleting" 
        onpageindexchanging="GridView1_PageIndexChanging">
        <PagerSettings FirstPageText="首页" LastPageText="最后一页" 
            Mode="NextPreviousFirstLast" NextPageText="下一页" PreviousPageText="上一页" />
        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        
        <RowStyle BackColor="#EFF3FB" />
        <Columns>
            <asp:BoundField DataField="ctime" HeaderText="发布时间" />
            <asp:BoundField DataField="neirong" HeaderText="内容" />
            <asp:CommandField ShowDeleteButton="True" />
        </Columns>
        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <EditRowStyle BackColor="#2461BF" />
        <AlternatingRowStyle BackColor="White" />
    </asp:GridView>后台
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        int sk = e.NewPageIndex * 10-10;
        sqlDataContext sj = new sqlDataContext();
        var re = (from rd in sj.xxggb
                 where rd.bjid == bjid
                 orderby rd.ctime descending
                 select rd).Take(10).Skip(sk);
        GridView1.DataSource = re;
        GridView1.DataBind();
    }