当前位置:编程学习 > C#/ASP.NET >>

asp.net gridview 翻页后,选择行数据还是第一页上的数据

用 textbox,GridView 和PopupControlExtender 自定义了一个下拉框控件dropdown,网页上使用一切都正常。现在让GridView 自动翻页,翻页能正确显示,但 翻页后,画面上GridView 第一页后面的页面上选择的行数据,都是第一页上的数据。具体的现象是 GridView 翻到第二页后,画面上自定义控件dropdown也显示了第二页上的数据,但选择第二行后,
Server.HtmlDecode(DataSource.Rows(grdDropDown.SelectedIndex)(1).ToString.Trim)
取到的值 还是第一页上相应行的数据。请教这个问题如何解决



自定义了一个下拉框控件dropdown代码如下

<asp:TextBox ID="txtDropDown" runat="server" CssClass="DropDownTextStile" AutoPostBack="true" />
<asp:Panel ID="panDropDown" runat="server" CssClass="DropDownPanalStyle" Style="display:none;visibility: hidden">
    <asp:TextBox ID="txtSearch" runat="server"></asp:TextBox>
    <asp:Button ID="btnSearch" runat="server" Text="検索"/>

    <asp:GridView ID="grdDropDown" runat="server" AutoGenerateColumns="false" CssClass="DropDownGridStyle" AllowPaging="true" PageSize="10">

        <RowStyle BackColor="#ffffff" />
        <HeaderStyle CssClass="DropDownGridHeaderStyle"/>
        <AlternatingRowStyle BackColor="#ffffff" />
        <SelectedRowStyle BackColor="#ffffff" />
    </asp:GridView>
</asp:Panel>

<asp:PopupControlExtender ID="PopupDropDown" runat="server"
                            TargetControlID="txtDropDown" Position="Bottom" PopupControlID="panDropDown" >
</asp:PopupControlExtender> asp.net ,表格,翻页,数据选择 --------------------编程问答-------------------- autopostback=true 好像有这个属性吧,你要让他回调,不然不会执行的啊,
http://bbs.816go.com --------------------编程问答-------------------- 楼主 就一个gridview 你用开这么多贴么? 这种问题 网上一查就有答案了! 传送门 --------------------编程问答-------------------- 自己用sql语句 分页吧
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,