2013-04-24 65 views
3

我創建一個和下一個環節,現在當我加入一個下拉到它不工作根據需要控制一個AJAX頁面自定義控件..C#尋呼機問題與下拉

我已經使用的代碼形式http://www.flixon.com/Articles/Custom-ASPNET-Data-Pager-Control-22.aspx

當我添加一個下拉菜單,然後在選定的索引更改上一個和下一個按鈕正在消失。我相信這是由於我在預渲染事件中綁定了下拉菜單

+1

-1:沒有足夠的信息給出有關問題 – 2013-04-24 08:24:42

回答

0

而不是在預渲染事件中綁定下拉以進行分頁,您還可以在綁定網格時綁定它。

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> 

試試這個。