UpdatePanel UpdateMode Conditional in asp.net ajax

UpdatePanel UpdateMode Conditional
UsingUpdateModeConditional.aspx

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

<!DOCTYPE html>

<script runat="server">
    protected void Page_Load(object sender, EventArgs e)
    {
        Label1.Text = DateTime.Now.ToLongTimeString();
    }
    protected void ListBox1_SelectedIndexChanged(object sender, EventArgs e)
    {
        Panel1.BackColor = Color.FromName(ListBox1.SelectedItem.Text);
        Panel2.BackColor = Color.FromName(ListBox1.SelectedItem.Text);
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>Ajax UpdatePanel - How to use UpdateMode Conditional in asp.net ajax</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h2 style="color:DarkBlue; font-style:italic;">Ajax UpdatePanel Example: Using UpdateMode Conditional</h2>
        <hr width="550" align="left" color="LightBlue" />
        <asp:ScriptManager 
            ID="ScriptManager1"
            runat="server"
            >
        </asp:ScriptManager>
        <asp:Label 
            ID="Label1"
            runat="server"
            ForeColor="Salmon"
            Font-Size="Medium"
            Font-Bold="true"
            >
        </asp:Label>
        <br /><br />
        <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
                <asp:Panel 
                    ID="Panel1"
                    runat="server"
                    BorderWidth="1"
                    Height="50"
                    Width="450"
                    BackColor="SeaGreen"
                    ForeColor="Snow"
                    HorizontalAlign="Center"
                    Font-Bold="true"
                    >
                    Panel1 and Triggers both are under UpdatePanel1.
                </asp:Panel>
            </ContentTemplate>
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="ListBox1" EventName="SelectedIndexChanged" />
            </Triggers>
        </asp:UpdatePanel>
        <br />
        <asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
                <asp:Panel 
                    ID="Panel2"
                    runat="server"
                    BorderWidth="1"
                    Height="50"
                    Width="450"
                    BackColor="SeaGreen"
                    ForeColor="Snow"
                    HorizontalAlign="Center"
                    Font-Bold="true"
                    >
                    This is Panel2 and it is under UpdatePanel2.
                </asp:Panel>
            </ContentTemplate>
        </asp:UpdatePanel>
        <br /><br />
        <asp:ListBox 
            ID="ListBox1"
            runat="server"
            ForeColor="DeepPink"
            Width="200"
            SelectionMode="Single"
            Font-Italic="true"
            AutoPostBack="true"
            OnSelectedIndexChanged="ListBox1_SelectedIndexChanged"
            Height="150"
            Font-Bold="true"
            Font-Size="Large"
            Font-Names="Comic Sans MS"
            >
            <asp:ListItem>SaddleBrown</asp:ListItem>
            <asp:ListItem>DeepPink</asp:ListItem>
            <asp:ListItem>IndianRed</asp:ListItem>
            <asp:ListItem>Orange</asp:ListItem>
            <asp:ListItem>Salmon</asp:ListItem>
            <asp:ListItem>DarkSalmon</asp:ListItem>
            <asp:ListItem>OrangeRed</asp:ListItem>
            <asp:ListItem>CornFlowerBlue</asp:ListItem>
        </asp:ListBox>
    </div>
    </form>
</body>
</html>
Related asp.net ajax examples