updatepanel,timer和trigger中的问题 [英] problem in updatepanel , timer and trigger

查看:90
本文介绍了updatepanel,timer和trigger中的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题,两个更新窗格,其中一个有计时器,第二个有下拉列表和其他控件当我从下拉列表中选择时,它会影响计时器!然后关闭..

如何停止下拉效果?



我的代码?



my problem ,, two update pane and one of them had timer , the second had dropdown list and other controls when i choose from dropdownlist , it affect with timer !! and drop down close ..
how to stop effect of dropdown ??

my code ?

<h2>
    Welcome to ASP.NET!
</h2>
<p>
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
</p>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" ChildrenAsTriggers="false" UpdateMode="Conditional">
    <ContentTemplate>
        <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
    </ContentTemplate>
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="Timer1" />
    </Triggers>
</asp:UpdatePanel>
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
    <ContentTemplate>
        <asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>
        <br />
        <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"

            onselectedindexchanged="DropDownList1_SelectedIndexChanged">
            <asp:ListItem Value="0">jerusalem Capital</asp:ListItem>
            <asp:ListItem Value="1">Haifa</asp:ListItem>
            <asp:ListItem Value="2">Jaffa</asp:ListItem>
            <asp:ListItem Value="3">Gaza</asp:ListItem>
        </asp:DropDownList>
    </ContentTemplate>
</asp:UpdatePanel>
<asp:Timer ID="Timer1" runat="server" Interval="2000" ontick="Timer1_Tick">
</asp:Timer>

推荐答案

默认updatemode始终用于第二个updatepanel,因此UpdatePanel控件的内容在源自页面上任何位置的每个回发更新。相应地更改第二个面板的updatemode属性..看看http://msdn.microsoft.com/en-CA/library/system.web.ui.updatepanel.updatemode.aspx [ ^ ]
Default updatemode is always for second updatepanel and as a result UpdatePanel control''s content is updated on every postback that originates from anywhere on the page.Change the updatemode property of second panel accordingly..have a look at http://msdn.microsoft.com/en-CA/library/system.web.ui.updatepanel.updatemode.aspx[^]


这篇关于updatepanel,timer和trigger中的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆