日期:2014-05-17  浏览次数:20478 次

UpdatePanel中Timer触发的刷新问题,如何不让里面的DropDownList刷新?
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
        <div class="operates">
            <asp:DropDownList ID="toolStripCboPages" AutoPostBack="true" OnSelectedIndexChanged="toolStripCboPages_SelectedIndexChanged"   Width="150" runat="server">
            </asp:DropDownList>
        </div>

      <asp:GridView ID="GridView00" Visible="false" runat="server" RowStyle-HorizontalAlign="Center" CssClass="gridview_m"  Width="100%"  >
      </asp:GridView>

        <asp:Timer ID="Timer1" runat="server" Interval="1000" ontick="Timer1_Tick"></asp:Timer>
    </ContentTemplate>
</asp:UpdatePanel>

问题是这样的:
一个UpdatePanel,里面有一个DropDownList、GridView  和Timer。

DropDownList 里面有多个项, GridView 里面显示DropDownList 选中项的详细信息。
用Timer1 是做到GridView 里面的数据实时刷新,并且隔上一定的时间DropDownList 里面的值就会自动变,比如每5秒改变一次,类似于定时翻页功能。

并且也可以人为的选择DropDownList 的值来改变GridView 里面的内容

现在的问题是 当我点开DropDownList  下拉框的时候,如果刚好赶上Timer 刷新,DropDownList  的下拉框就自动收起来了

也就是DropDownList  的选择事件一定要在Timer1。Interval的时间内完成。

怎么样能实现 UpdatePanel 不更新DropDownList   ?

------解决方案--------------------
JS+AJAX读取 局部刷新
------解决方案--------------------
UpdatePanel 不包含drp你试试。
  <div class="operates">
 DropDownList   </div>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
  <ContentTemplate>

GridView 
Timer 
  </ContentTemplate>
</asp:UpdatePanel>


------解决方案--------------------
把你的DropDownList扔UpdatePanel外面
------解决方案--------------------
在timer代码里面5秒翻页时候改变drp的值
------解决方案--------------------
每秒钟都刷新,会死人的
------解决方案--------------------
引用:
在timer代码里面5秒翻页时候改变drp的值

+1

在Timer1_Tick里写 5秒的时候改变下拉框的value
------解决方案--------------------
用Ajax刷,时间设置长点撒
------解决方案--------------------
引用:
时间设置长点没啥问题,但没有从根本上解决问题,客户的数据每2-3秒都会刷新一次。


有没有知道如何 捕捉 dropdownlist 的下拉框 弹出或收起 的事件 ????


下拉框 弹出的时候 让timer1暂停, 收起后 timer继续