GridView里面的自定义分页按钮点击无反应是什么原因?
这是aspx前台代码(GridView里面的PagerTemplate):<table><tr><td>第<asp:LabelID="lblPageIndex"runat...
这是aspx前台代码(GridView里面的PagerTemplate): <table> <tr> <td> 第<asp:Label ID="lblPageIndex" runat="server" Text='<%# ((GridView)Container.Parent.Parent).PageIndex + 1 %>'></asp:Label>页/共<asp:Label ID="lblPageCount" runat="server" Text='<%# ((GridView)Container.Parent.Parent).PageCount %>'></asp:Label>页 <asp:LinkButton ID="btnFirst" runat="server" CausesValidation="False" CommandName="Page" Text="首页" CommandArgument="first" OnCommand="gvPage_Command"> </asp:LinkButton> <asp:LinkButton ID="btnPrev" runat="server" CausesValidation="False" CommandName="Page" Text="上一页" CommandArgument="prev" OnCommand="gvPage_Command"> </asp:LinkButton> <asp:LinkButton ID="btnNext" runat="server" CausesValidation="False" CommandName="Page" Text="下一页" CommandArgument="next" OnCommand="gvPage_Command"> </asp:LinkButton> <asp:LinkButton ID="btnLast" runat="server" CausesValidation="False" CommandName="Page" Text="尾页" CommandArgument="last" OnCommand="gvPage_Command"> </asp:LinkButton> <asp:TextBox ID="txtPageIndex" runat="server" Width="20"></asp:TextBox> <asp:Button ID="btnGo" runat="server" Text="GO" CausesValidation="false" CommandName="Page" CommandArgument="go" OnCommand="gvPage_Command" /> </td> </tr> </table> 这是cs后台代码: protected void gvPage_Command(object sender, EventArgs e) {//在这里设置断点,可是根本没进来,啥回事? switch (((LinkButton)sender).CommandArgument.ToString()) { case "first": gvSearch.PageIndex = 0; break; case "last": gvSearch.PageIndex = gvSearch.PageCount - 1; break; case "prev": if (gvSearch.PageIndex > 0) { gvSearch.PageIndex -= 1; } break; case "next": if (gvSearch.PageIndex < gvSearch.PageCount - 1) { gvSearch.PageIndex += 1; } break; } if (ViewState["gsql"] != null) { string gsql = ViewState["gsql"].ToString(); BindGrid(gsql); } } 我在方法里面设置了断点,可是就是进不去,用OnCommand、OnClick和GridView的RowCommand都没反应,这是为什么呢?因为字数有限,所以方法里面部分代码没显示
展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询