日期:2014-05-17 浏览次数:20497 次
protected void Timer1_Tick(object sender, EventArgs e) { DataSet ds = AccessDAL.Books.Books_Tanchu(0, 0); if (ds.Tables[0].Rows.Count > 0) { Literal1.Text = "<div style=\"height:300px;\">"; } else { Literal1.Text = "<div style=\"height:300px;display:none;\">"; } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { Timer1_Tick(Timer1, new EventArgs()); } }
<asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional"> <ContentTemplate> <asp:Timer ID="Timer1" runat="server" Interval="5000" ontick="Timer1_Tick"></asp:Timer> <asp:Literal ID="Literal1" runat="server"></asp:Literal> <div id="msg_win" style="top:503px;overflow: hidden;"> <div class="icos"><a id="msg_min" title="最小化" href="javascript:void 0">_</a><a id="msg_close" title="关闭" href="javascript:void 0">×</a></div> <div id="msg_title">通知:</div> <div id="msg_content">您好,当前您有信息未读。<a href="Books/books_list.aspx?page=31" target="mainFrame">点击进入</a></div> </div></div> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="Timer1" /> </Triggers> </asp:UpdatePanel>