Click here to Skip to main content
12,550,013 members (42,707 online)
Rate this:
Please Sign up or sign in to vote.
See more: ASP.NET
Hi , I am having two update panels -panel1 and panel2 and a timer to update panel1 but timer updates both the update panel..

Here is the code..

protected void Page_Load(object sender, EventArgs e)
        lbl_Date.Text = DateTime.Now.ToString();
        lbl_Date0.Text = DateTime.Now.ToString();
        lbl_Date1.Text = DateTime.Now.ToString();
    protected void Timer1_Tick(object sender, EventArgs e)
        lbl_Date0.Text = DateTime.Now.ToString();

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<head runat="server">
    <title>Untitled Page</title>
    <form id="form1" runat="server">
                <asp:Label ID="lbl_Date" runat="server" Text="Label"> </asp:Label>
                <asp:ScriptManager ID="ScriptManager1" runat="server">
            <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
            <br />
            <br />
            <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
            &nbsp;<asp:Button ID="Button1" runat="server" Text="Button" />

            <br />
            <asp:UpdatePanel ID="UpdatePanel2" runat="server">
                    <asp:Timer ID="Timer1" runat="server" Interval="1000">
                    <br />
                    <asp:Label ID="lbl_Date0" runat="server" Text="Label"> </asp:Label>
            <br />
            <br />
            <asp:UpdatePanel ID="UpdatePanel3" runat="server">
                    <br />
                    <asp:Label ID="lbl_Date1" runat="server" Text="Label"> </asp:Label>

    <br />
Posted 24-Sep-12 4:54am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Put UpdateMode="Conditional" in both the Update panels next to their ID's defined.

Refer, details here: MSDN: UpdatePanel.UpdateMode Property [^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.161021.1 | Last Updated 24 Sep 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100