UpdatePanel 刷新问题
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>
<asp:Timer ID="Timer1" OnTick="Timer1_Tick" runat="server" Interval="10000" />
<asp:UpdatePanel ID="StockPricePanel" runat="server" UpdateMode="Conditional">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Timer1" />
</Triggers>
<ContentTemplate>
Stock price is <asp:Label id="StockPrice" runat="server"></asp:Label><BR />
as of <asp:Label id="TimeOfPrice" runat="server"></asp:Label>
</ContentTemplate>
</asp:UpdatePanel>
<div>
Page originally created at <asp:Label ID="OriginalTime" runat="server"></asp:Label>
</div>
</form>
</body>
</html>