2 回答

TA貢獻1848條經驗 獲得超10個贊
是不是timer控件每次刷新它都不執行頁面的pageload事件?每一次都執行page_load事件〔但是對不想每次執行的部分ispostback屬性控制?!?/p>
可以讓timer執行page_load事件嗎?行。
scriptmanager要放在頁面的最上面,不能在updatepanel中。timer設置事件后、還要設置timer的更新頻率屬性。
實時問題,不能實現實時的數據更新、只能實現定時檢索數據變化的方式、

TA貢獻1827條經驗 獲得超8個贊
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<asp:Timer ID="Timer1" runat="server" Interval="1000" ontick="Timer1_Tick"></asp:Timer>
</ContentTemplate>
</asp:UpdatePanel>
</div>
protected void Timer1_Tick(object sender, EventArgs e)
{
Label1.Text = DateTime.Now.ToString();
}
- 2 回答
- 0 關注
- 736 瀏覽
添加回答
舉報