作者spiderman007 (千里之外)
看板Web_Design
標題[問題] ASP.NET 關於content page的update panel
時間Fri Oct 10 08:09:15 2014
爬了一些文發現...
已在master page使用scriptmanager的情況下,
在content page中可不必再加入scriptmanager,
但因為我在content page中想放一個update panel的區域,
打算用timer來做內容的更新,發現怎麼試都不會有變化??
不知是哪裡有錯!?
首先在content page內插入一段
<asp:updatepanel ....>
<contentTemplate>
<asp:Label ......></asp:Label>
</contentTemplate>
<Triggers>
<asp:AsyncPostBakTrigger: ControlID="Timer1" EventName="tick" />
</Triggers>
</asp:updatepanel>
c#程式碼
protected void Timer1_Tick(object sender, EventArgs e)
{
this.Label1.Text = DateTime.Now.LongTimeString();
}
想要在content page中看到時間的變化,但始終不變? 可否請各位大大指點迷津..謝謝!!
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 220.136.144.60
※ 文章網址: http://www.ptt.cc/bbs/Web_Design/M.1412899758.A.389.html
→ GoalBased: 那你有爬updatepanel的文嗎? 10/10 08:24
推 BigLoser: 你的timer放在哪裡? 10/10 12:38
→ spiderman007: 樓上大大,我放在content page內,在update panel外 10/10 21:08
→ spiderman007: 及update panel內contentTemplate內都試過,都不行! 10/10 21:09
推 BigLoser: 請問這位溫拿,能直接給code嗎? 10/10 21:53
推 CrazyAngel: 用ajax做比較方便 10/11 02:06
→ spiderman007: 謝謝B大關心,我剛寫完一個sample code發現可以,剛 10/11 17:50
→ spiderman007: debug發現是我寫的ajax某些部份有問題導致此情況。 10/11 17:50