两个 UpdatePanelAnimation Extenders - 导致动画在两个更新面板上触发

发布于 2024-09-15 07:23:36 字数 1908 浏览 1 评论 0原文

又是我!

我有以下内容根据更新面板更改标签颜色:

<asp:UpdatePanelAnimationExtender ID="UpdatePanelAnimationExtender1" runat="server"
            Enabled="True" TargetControlID="UpdatePanel1">
            <Animations>
        <OnUpdating>
        <Color
        AnimationTarget="lblSearchResults1"
            Duration="1"
            StartValue="#FFFFFF"
            EndValue="#FFFFFF"
            Property="style"
            PropertyKey="color"/> 
         </OnUpdating>
         <OnUpdated>
        <Color 
        AnimationTarget="lblSearchResults1"
            Duration="1"
            StartValue="#FFFFFF"
            EndValue="#009685"
            Property="style"
            PropertyKey="color" />
        </OnUpdated>
            </Animations>
        </asp:UpdatePanelAnimationExtender>

很好。工作是一种享受。

但是,我在同一页面上但在不同的更新面板中也有以下内容:

<asp:UpdatePanelAnimationExtender ID="UpdatePanelAnimationExtender1" runat="server"
            Enabled="True" TargetControlID="UpdatePanel2">
            <Animations>
        <OnUpdating>
        <Color
        AnimationTarget="lblSearchResults2"
            Duration="1"
            StartValue="#FFFFFF"
            EndValue="#FFFFFF"
            Property="style"
            PropertyKey="color"/> 
         </OnUpdating>
         <OnUpdated>
        <Color 
        AnimationTarget="lblSearchResults2"
            Duration="1"
            StartValue="#FFFFFF"
            EndValue="#009685"
            Property="style"
            PropertyKey="color" />
        </OnUpdated>
            </Animations>
        </asp:UpdatePanelAnimationExtender>

这也很不错。但是,更新会导致两个标签中的任何一个触发时都会触发动画/颜色更改。

我该怎么做,或者我必须做什么,以便一次只有一个标签改变一个颜色,即当 UpdatePanel1 更新时,lblSearch1 改变颜色,但 lblSearch2 保持原样。

Me again!

I have the following that changes the label colour according to an update panel:

<asp:UpdatePanelAnimationExtender ID="UpdatePanelAnimationExtender1" runat="server"
            Enabled="True" TargetControlID="UpdatePanel1">
            <Animations>
        <OnUpdating>
        <Color
        AnimationTarget="lblSearchResults1"
            Duration="1"
            StartValue="#FFFFFF"
            EndValue="#FFFFFF"
            Property="style"
            PropertyKey="color"/> 
         </OnUpdating>
         <OnUpdated>
        <Color 
        AnimationTarget="lblSearchResults1"
            Duration="1"
            StartValue="#FFFFFF"
            EndValue="#009685"
            Property="style"
            PropertyKey="color" />
        </OnUpdated>
            </Animations>
        </asp:UpdatePanelAnimationExtender>

Fine. Works a treat.

However, I also have the following on the same page but within a different update panel:

<asp:UpdatePanelAnimationExtender ID="UpdatePanelAnimationExtender1" runat="server"
            Enabled="True" TargetControlID="UpdatePanel2">
            <Animations>
        <OnUpdating>
        <Color
        AnimationTarget="lblSearchResults2"
            Duration="1"
            StartValue="#FFFFFF"
            EndValue="#FFFFFF"
            Property="style"
            PropertyKey="color"/> 
         </OnUpdating>
         <OnUpdated>
        <Color 
        AnimationTarget="lblSearchResults2"
            Duration="1"
            StartValue="#FFFFFF"
            EndValue="#009685"
            Property="style"
            PropertyKey="color" />
        </OnUpdated>
            </Animations>
        </asp:UpdatePanelAnimationExtender>

This also works a treat. However, the update causes the animation/colour change to fire on both labels when either of them fires.

How do, or what do I have to do so that only one label changes colour one at a time i.e. when UpdatePanel1 updates, lblSearch1 changes colour but lblSearch2 stays as is.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

萝莉病 2024-09-22 07:23:36

我的猜测是您的问题是 UpdatePanels 而不是动画扩展器。您需要检查 UpdatePanel 的 UpdateMode 属性。它需要有条件才能让您的方案发挥作用。如果两个 UpdatePanel 均已更新(通过 UpdateMode=Always 或通过调用 Update() 方法的编程方式),则两个动画都会被触发。

My guess is that your problem is with UpdatePanels and not with animation extenders. You need to check the UpdateMode property for your UpdatePanels. It needs to be conditional for your scenario to work. If both UpdatePanels are updated (either via UpdateMode=Always or via programmatic way of calling Update() method), both animations will be triggered.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文