下拉菜单的c#分页问题

本文关键字:问题 分页 下拉菜单 | 更新日期: 2023-09-27 18:10:33

我已经创建了一个ajax页面自定义控件与前一个和下一个链接,现在,当我添加一个下拉到控件,它不工作如预期..

我使用了代码形式http://www.flixon.com/Articles/Custom-ASPNET-Data-Pager-Control-22.aspx

当我添加一个下拉,然后在选定的索引更改前一个和下一个按钮正在消失。我想这是因为我在预渲染事件

下拉菜单的c#分页问题

中绑定了下拉列表

除了在预呈现事件中绑定下拉分页,你还可以在绑定网格时绑定它。

if (gridView.BottomPagerRow != null)
{
  GridViewRow myGridViewRow = gridView.BottomPagerRow;
                DropDownList ddCurrentPage = (DropDownList)myGridViewRow.Cells[0].FindControl("ddCurrentPage");
//To do to bind Drop down
}

,你也可以显式调用下拉选择索引更改事件

下面是寻呼机模板

的代码
<PagerTemplate>                                           
    <asp:Button runat="server" ID="imgPagePrevious" CssClass="Pagingbutton" Text="<"CommandArgument="Prev" CommandName="Page" OnCommand="imgPagePrevious_Command" />
    <asp:DropDownList ID="ddCurrentPage" runat="server" CssClass="PagingDrop" AutoPostBack="True" OnSelectedIndexChanged="ddCurrentPage_SelectedIndexChanged">
    </asp:DropDownList>
     <asp:Button runat="server" ID="imgPageNext" CssClass="Pagingbutton" Text=">" CommandArgument="Next" CommandName="Page" OnCommand="imgPageNext_Command"/>                                          
  </PagerTemplate>

试试这个。