如何查看页面底部点击数的第二页 [英] How to view 2nd page in paging on click numbers in bottom

查看:48
本文介绍了如何查看页面底部点击数的第二页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试搜索,并且网格显示了20条记录的结果.

I am trying to search and my grids shows me results of 20 records.

如果我已申请,则允许分页为true,并且页面大小为20

If i have applied allow paging true and page size is 20

然后在网格"的第二页上单击,我的整个网格将刷新,并再次以第一页显示整个网格.

Then on click on 2nd page in Grid my whole grid is refreshing ans showing me whole grid once again with its 1st page.

如果记录为20,页面大小为10,如何查看最近的10条记录(从11到20)

How do i view my last 10 records which are from 11 to 20 if records are 20 and page size is 10

网格的客户端代码

<div id="divApplication" runat="server">
    <asp:GridView ID="gvApplication"
        runat="server"
        AutoGenerateColumns="false"
        AllowPaging="true"
        AllowSorting="True"
        AlternatingRowStyle-CssClass="alt"
        PagerStyle-CssClass="pgr"
        OnPageIndexChanging="OnPageIndexChanging"
        CssClass="table table-bordered table-striped"
        PageSize="10" Width="50%">

        <Columns>
            <asp:TemplateField HeaderText='Application' HeaderStyle-VerticalAlign="Middle">
                <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" CssClass="chkbox" />
                <ItemTemplate>
                    <asp:Label ID="lblFirstName" runat="server"
                        att='<%#DataBinder.Eval(Container.DataItem,"ID")%>' Text='<%# SetLinkCodeApplication(Convert.ToInt64(DataBinder.Eval(Container.DataItem,"ID")),DataBinder.Eval(Container.DataItem,"Application").ToString()) %>'></asp:Label>
                </ItemTemplate>
                <ItemStyle Width="3%" HorizontalAlign="left" />
            </asp:TemplateField>
        </Columns>

    </asp:GridView>
</div>

在服务器端代码的C#中绑定我的网格

Binding my grid in C# on server side code

public void fncfillApplication()
{
    try
    {
        DataSet ds = new DataSet();
        ds.ReadXml(Server.MapPath("Application.xml"));
        if (ds.Tables[0].Rows.Count != 0)
        {
            gvApplication.DataSource = ds;
            gvApplication.DataBind();
        }
    }
    catch (Exception ex)
    {
        ex.Message.ToString();
    }
}

protected void OnPageIndexChanging(object sender, GridViewPageEventArgs e)
{
    gvApplication.PageIndex = e.NewPageIndex;
    this.fncfillApplication();
}

用于在编辑模式下绑定我的数据的Setlinkcode

Setlinkcode for Binding my data in edit mode

public string SetLinkCodeApplication(Int64 sId, string sName)
{
    string functionReturnValue = null;
    try
    {
        functionReturnValue = "<a href=javascript:fncopenEditPopUpApplication(" + sId + ")>" + sName.Trim() + "</a>";
        //return functionReturnValue;
    }
    catch (Exception ex)
    {
        throw;
    }
    return functionReturnValue;
}

我正在使用Xml数据源绑定数据

I am using Xml Datasource to bind data

推荐答案

我认为它对您有帮助

ds.Tables[0].Select("ID=1 AND ID2=3");

这篇关于如何查看页面底部点击数的第二页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆