自定义了一个GridView分页.但是为什么无法进入onpageindexchanging="gv_PageIndexChanging" 事件.------------------------------------
<asp:GridView ID="gv" runat="server" ForeColor="Black" Width="100%"
CssClass="gridviewStyle" EnableViewState="false"
EmptyDataText="暂无数据,请添加!" DataKeyNames="KEYID" CellPadding="0" AutoGenerateColumns="False"
PageSize="19" BackColor="LightBlue" BorderStyle="None" AllowPaging="True" onpageindexchanging="gv_PageIndexChanging"
onrowdatabound="gv_RowDataBound">
---------------------------------
分页代码:<PagerTemplate>
<table style="font-size: 12px" width="100%" >
<tbody>
<tr>
<td style="height: 18px; 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" />
</td>
</tr>
</tbody>
</table> </PagerTemplate>-------------------------------------------------------问题来了:<asp:linkbutton id="btnNext" runat="server" causesvalidation="False" commandargument="Next" commandname="Page" text="下一页" />
点击下一页,那个gv_PageIndexChanging事件无法激发. 所以页面显示[无法显示该网页].之前有2个页面都做好了的.分页能成功.这里为什么就失灵了?是不是什么东西有冲突导致?小弟实在琢磨不透了.忘各位大虾帮把劲`
<asp:GridView ID="gv" runat="server" ForeColor="Black" Width="100%"
CssClass="gridviewStyle" EnableViewState="false"
EmptyDataText="暂无数据,请添加!" DataKeyNames="KEYID" CellPadding="0" AutoGenerateColumns="False"
PageSize="19" BackColor="LightBlue" BorderStyle="None" AllowPaging="True" onpageindexchanging="gv_PageIndexChanging"
onrowdatabound="gv_RowDataBound">
---------------------------------
分页代码:<PagerTemplate>
<table style="font-size: 12px" width="100%" >
<tbody>
<tr>
<td style="height: 18px; 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" />
</td>
</tr>
</tbody>
</table> </PagerTemplate>-------------------------------------------------------问题来了:<asp:linkbutton id="btnNext" runat="server" causesvalidation="False" commandargument="Next" commandname="Page" text="下一页" />
点击下一页,那个gv_PageIndexChanging事件无法激发. 所以页面显示[无法显示该网页].之前有2个页面都做好了的.分页能成功.这里为什么就失灵了?是不是什么东西有冲突导致?小弟实在琢磨不透了.忘各位大虾帮把劲`
问题肯定不是代码!!
其他事件是否正常如onrowdeleting="GridView1_RowDeleting" onrowediting="GridView1_RowEditing"
我试了下 SQL加了句 top 100
就能正常分页` 原来有接近100页
这样也行?
我试了下 SQL加了句 top 100
就能正常分页` 原来有接近100页
这样也行?