2
Answers

Master Page - Current time can not be displayed update panel

Kavi suja

Kavi suja

11y
2.1k
1
Hi,
   I use timer to display current time in lable.But it does not working in Master Page.I added scriptmanager.I attached my Master page code here.
can anyone help me?
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site1.master.cs" Inherits="updatepage.Site1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <asp:ContentPlaceHolder ID="head" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <asp:ScriptManager ID="script" runat="server"></asp:ScriptManager>
    <asp:Panel ID="panel1" runat="server">
        <asp:Label ID="Label1" runat="server" 
            style="z-index: 1; left: 367px; top: 15px; position: absolute; height: 19px; font-weight: 700" 
            Text="MainPage"></asp:Label>
            <asp:Timer ID="timer1" runat="server" Interval="10000" ontick="timer1_Tick"></asp:Timer>
            <asp:UpdatePanel ID="update" runat="server" UpdateMode="Conditional" >
            <ContentTemplate>
            <asp:Label ID="lbltime" runat="server"></asp:Label>
            </ContentTemplate>
            </asp:UpdatePanel>
            </asp:Panel>
        <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
        
            
        
        </asp:ContentPlaceHolder>
    </div>
    </form>
</body>
</html>


In content page,the time in lable does not display.But i include
 lbltime.Text = DateTime.Now.ToString(); on timer1_click()function..
















Answers (2)