1

我在标签上使用带有 FadeOut/FadeIn 动画的 UpdatePanelAnimationExtender。我可以在 FadeOut 之后更改标签的文本吗?

<ajax:UpdatePanelAnimationExtender ID="upae" BehaviorID="animation" runat="server" TargetControlID="update">
            <Animations>
                <OnUpdating>
                    <Sequence>
                    </Sequence>
                </OnUpdating>
                <OnUpdated>
                    <Sequence >
                        <FadeOut AnimationTarget="lblUpdate1" duration="1.0" Fps="24" minimumOpacity="0" />
                        **<TextChangeAnimationHere? prop1="value1" prop2="value2" etc./>**
                        <FadeIn AnimationTarget="lblUpdate1" duration="1.0" Fps="24" minimumOpacity="0" />
                    </Sequence>
                </OnUpdated>
            </Animations>
        </ajax:UpdatePanelAnimationExtender>
4

1 回答 1

1

这是我想出的解决方案。

asp代码:

<form id="frmMain" runat="server">
    <ajax:ToolkitScriptManager runat="server" ID="ToolkitScriptManager1" />

    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <asp:Label ID="lblMsg" runat="server" Text="Label">This is a test...</asp:Label>
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="myTimer" EventName="Tick" />
        </Triggers>
    </asp:UpdatePanel>

    <ajax:UpdatePanelAnimationExtender ID="upae" runat="server" TargetControlID="UpdatePanel1">
        <Animations>
            <OnUpdating>
                <Sequence>
                    <FadeOut AnimationTarget="lblMsg" duration="1.0" Fps="30" minimumOpacity="0" />
                </Sequence>
            </OnUpdating>
            <OnUpdated>
                <Sequence>
                    <FadeIn AnimationTarget="lblMsg" duration="1.0" Fps="30" minimumOpacity="0" />
                </Sequence>
            </OnUpdated>
        </Animations>
    </ajax:UpdatePanelAnimationExtender>

    <asp:Timer runat="server" Interval="6000" ID="myTimer" OnTick="myTimer_Tick" />
</form>

C#代码隐藏:

public partial class WebForm1 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void myTimer_Tick(object sender, EventArgs e)
    {
        System.Threading.Thread.Sleep(1000);
        lblMsg.Text = DateTime.Now.ToString();
    }   
}

David Miyamasu 致敬,因为他为我指明了正确的方向。

于 2014-02-05T18:33:20.927 回答