日期:2014-05-17 浏览次数:20434 次
<asp:ScriptManager ID="ScriptManager1" runat="server" /> <div> <asp:Timer ID="Timer1" OnTick="Timer1_Tick" runat="server" Interval="10000"> </asp:Timer> </div> <li><a href="#">消息 <asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Conditional" runat="server"> <Triggers> <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" /> </Triggers> <ContentTemplate> <asp:Label ID="mesnum" runat="server" ForeColor="#CC0000"></asp:Label> </ContentTemplate> </asp:UpdatePanel> </a></li>
protected void Timer1_Tick(object sender, EventArgs e) { string userid = Session["UserId"].ToString(); DataTable dt = new MessagesDAO().mescheck(new ModelMessages(userid)); mesnum.Text = dt.Rows.Count.ToString(); Timer1.Enabled = true; }