How to use ContentTemplate in asp.net ajax

Ajax ContentTemplate
UsingContentTemplate.aspx

<%@ Page Language="C#" %>
<%@ Import Namespace="System.Drawing" %>
<%@ Import Namespace="System.Drawing.Text" %>

<!DOCTYPE html>
<script runat="server">
    string[] colorArray = {"DeepPink", "DeepSkyBlue", "Fuchsia", "Green", "LightBlue", "Maroon", "Navy", "Orchid", "Peru", "Plum", "Red"};

    protected void Page_Load(object sender, System.EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            Label1.Text = colorArray[0];
            Label1.ForeColor = Color.FromName(Label1.Text);
        }
    }
    protected void Timer1_Tick(object sender, EventArgs e)
    { 
        
        int indexOf = Array.IndexOf(colorArray,Label1.Text);
        int nextIndex = indexOf+1;
        if (nextIndex > colorArray.Length)
        {
            Label1.ForeColor = Color.FromName(colorArray[0]);
            Label1.Text = colorArray[0].ToString();
        }
        else
        { 
            Label1.ForeColor = Color.FromName(colorArray[nextIndex]);
            Label1.Text = colorArray[nextIndex].ToString();
        }
    }
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>Ajax ContentTemplate - How to use ContentTemplate in asp.net ajax</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h2 style="color:DodgerBlue; font-style:italic;">Ajax ContentTemplate Example: How To Use ContentTemplate</h2>
        <hr width="550" align="left" color="CornFlowerBlue" />
        <asp:ScriptManager 
            ID="ScriptManager1"
            runat="server"
            >
        </asp:ScriptManager>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <asp:Timer 
                    ID="Timer1"
                    runat="server"
                    OnTick="Timer1_Tick"
                    Interval="2000"
                    >
                </asp:Timer>
                <asp:Label 
                    ID="Label1" 
                    runat="server" 
                    ForeColor="DeepPink"
                    Font-Size="XX-Large"
                    Font-Names="Comic Sans MS"
                    Font-Bold="true"
                    >
                </asp:Label>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
    </form>
</body>
</html>
Related asp.net ajax examples