初学GridView分页 有首页 上一页 下一页 尾页 文本框输入页数 点GO按钮 跪求后台代码怎么写??aspx页面
<asp:gridview id="GridView1" runat="server" allowpaging="True" pagesize="10" autogeneratecolumns="False" onpageindexchanging="GridView1_PageIndexChanging">
<columns>
<asp:boundfield datafield="CompanyName" headertext="CompanyName" sortexpression="CompanyName" />
<asp:boundfield datafield="ContactTitle" headertext="ContactTitle" sortexpression="ContactTitle" />
<asp:boundfield datafield="Phone" headertext="Phone" sortexpression="Phone" />
<asp:boundfield datafield="Fax" headertext="Fax" sortexpression="Fax" />
<asp:boundfield datafield="ContactName" headertext="ContactName" sortexpression="ContactName" />
</columns>
<pagertemplate>
<table width="100%">
<tr>
<td style="text-align:right">
第<asp:Label id="lblPageIndex" runat="server" text='<%# ((GridView)Container.Parent.Parent).PageIndex + 1 %>' />页
共/<asp:Label id="lblPageCount" runat="server" text='<%# ((GridView)Container.Parent.Parent).PageCount %>' />页
<asp:linkbutton id="btnFirst" runat="server" causesvalidation="False" commandargument="First" commandname="Page" text="首页" />
<asp:linkbutton id="btnPrev" runat="server" causesvalidation="False" commandargument="Prev" commandname="Page" text="上一页" />
<asp:linkbutton id="btnNext" runat="server" causesvalidation="False" commandargument="Next" commandname="Page" text="下一页" />
<asp:linkbutton id="btnLast" runat="server" causesvalidation="False" commandargument="Last" commandname="Page" text="尾页" />
<asp:textbox id="txtNewPageIndex" runat="server" width="20px" text='<%# ((GridView)Container.Parent.Parent).PageIndex + 1 %>' />
<asp:linkbutton id="btnGo" runat="server" causesvalidation="False" commandargument="-1" commandname="Page" text="GO" />>
<asp:gridview id="GridView1" runat="server" allowpaging="True" pagesize="10" autogeneratecolumns="False" onpageindexchanging="GridView1_PageIndexChanging">
<columns>
<asp:boundfield datafield="CompanyName" headertext="CompanyName" sortexpression="CompanyName" />
<asp:boundfield datafield="ContactTitle" headertext="ContactTitle" sortexpression="ContactTitle" />
<asp:boundfield datafield="Phone" headertext="Phone" sortexpression="Phone" />
<asp:boundfield datafield="Fax" headertext="Fax" sortexpression="Fax" />
<asp:boundfield datafield="ContactName" headertext="ContactName" sortexpression="ContactName" />
</columns>
<pagertemplate>
<table width="100%">
<tr>
<td style="text-align:right">
第<asp:Label id="lblPageIndex" runat="server" text='<%# ((GridView)Container.Parent.Parent).PageIndex + 1 %>' />页
共/<asp:Label id="lblPageCount" runat="server" text='<%# ((GridView)Container.Parent.Parent).PageCount %>' />页
<asp:linkbutton id="btnFirst" runat="server" causesvalidation="False" commandargument="First" commandname="Page" text="首页" />
<asp:linkbutton id="btnPrev" runat="server" causesvalidation="False" commandargument="Prev" commandname="Page" text="上一页" />
<asp:linkbutton id="btnNext" runat="server" causesvalidation="False" commandargument="Next" commandname="Page" text="下一页" />
<asp:linkbutton id="btnLast" runat="server" causesvalidation="False" commandargument="Last" commandname="Page" text="尾页" />
<asp:textbox id="txtNewPageIndex" runat="server" width="20px" text='<%# ((GridView)Container.Parent.Parent).PageIndex + 1 %>' />
<asp:linkbutton id="btnGo" runat="server" causesvalidation="False" commandargument="-1" commandname="Page" text="GO" />>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货