日期:2014-05-18  浏览次数:20494 次

关于 asp:GridView 下拉分页的问题
GridView-PagerTemplate下拉分页的问题:页面载入没有问题,点选下拉也没有问题。

问题在:当下拉选择已经选择了最会一页会,想回头查看前页的话,选择下拉选项后页面刷新后 无反应 即并未导航到前一页,同时下拉框也变成空白的了(无下拉选项了)

代码如下:
ASPX:
C# code
<asp:GridView ID="GridView1" runat="server" Width="98%" BorderColor="#B4C9C6" CellPadding="0"
            BorderStyle="Solid" BorderWidth="1px" AutoGenerateColumns="False" PageSize="15"
            AllowPaging="true" ShowFooter="True" OnRowDataBound="GridView1_RowDataBound" OnDataBound="GridView1_DataBound">
            <RowStyle BorderColor="#B4C9C6" Height="24px" BorderStyle="Solid" BorderWidth="1px" />
            <HeaderStyle BackColor="#CEE6F7" BorderColor="#B4C9C6" BorderWidth="1px" Height="25px"
                BorderStyle="Solid" />
            <Columns>
                <asp:TemplateField HeaderText="序号" InsertVisible="False" ItemStyle-HorizontalAlign="Center"
                    ItemStyle-Width="3%">
                    <ItemTemplate>
                        <%# this.GridView1.PageIndex * this.GridView1.PageSize + this.GridView1.Rows.Count + 1 %>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="HKTXT" HeaderText="科目" ItemStyle-HorizontalAlign="Left"
                    ItemStyle-Width="18%"/>
                <asp:BoundField DataField="BELNR" HeaderText="文档" ItemStyle-HorizontalAlign="Center"
                    ItemStyle-Width="10%"/>
                <asp:BoundField DataField="ITEMC" HeaderText="内容" ItemStyle-HorizontalAlign="Left"
                    ItemStyle-Width="30%"/>
                <asp:BoundField DataField="AMTTT" HeaderText="内容" ItemStyle-HorizontalAlign="Left"
                    ItemStyle-Width="9%"/>
                <asp:BoundField DataField="RPDAT" HeaderText="汇报日期" ItemStyle-HorizontalAlign="Center"
                    ItemStyle-Width="9%"/>
                <asp:BoundField DataField="BUDAT" HeaderText="凭证日期" ItemStyle-HorizontalAlign="Center"
                    ItemStyle-Width="9%"/>
                <asp:BoundField DataField="AUGDT" HeaderText="报销日期" ItemStyle-HorizontalAlign="Center"
                    ItemStyle-Width="9%"/>
            </Columns>
            <PagerTemplate>
                <div class="pager" style=" height:25px;">
                    <asp:Label ID="lblCurrentPage" runat="server"></asp:Label>
                    <asp:LinkButton ID="lnkbtnFrist" runat="server" OnClick="lnkbtnFrist_Click">首页</asp:LinkButton>
                    <asp:LinkButton ID="lnkbtnPre" runat="server" OnClick="lnkbtnPre_Click">上一页</asp:LinkButton>
                    <asp:LinkButton ID="lnkbtnNext" runat="server" OnClick="lnkbtnNext_Click">下一页</asp:LinkButton>
                    <asp:LinkButton ID="lnkbtnLast" runat="server" OnClick="lnkbtnLast_Click">尾页</asp:LinkButton>
                    跳转到<asp:DropDownList ID="ddlCurrentPage" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlCurrentPage_SelectedIndexChang