UpdatePanelAnimationExtender - 用于更改Label.Text的动画

时间:2013-11-06 15:55:08

标签: asp.net ajax animation

我在标签上使用带有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>

1 个答案:

答案 0 :(得分:1)

这是我提出的解决方案。

aspx代码:

<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提示,指出我正确的方向。