Discussion:
ASP.NET如何可以使用Timer 物件?
(时间太久无法回复)
TaTMiNG@HK
2006-06-22 16:32:10 UTC
Permalink
©ÎªÌÃD¥ØŠ³ÂI€£ŠXŸA,šä¹ê§ÚªºTimer€wžg¹B§@¥¿±`,Šý«ožõ¹L°µData Bindªº€@šB,µ{Š¡œXŠp€U:

Dim aTimer As New System.Timers.Timer
AddHandler aTimer.Elapsed, AddressOf TimerEvent
aTimer.Interval = 3000
aTimer.Enabled = True
aTimer.AutoReset = True

Protected Sub TimerEvent(ByVal sender As Object, ByVal e As
System.Timers.ElapsedEventArgs)
Debug.Print("start" & Now )
Repeater1.DataBind()
Debug.Print("end" & Now )
End Sub

Šb¿é¥Xµøµ¡€€,³£¥i¥H¬Ý¥XDebug.PrintªºStart ©MEnd ©MNowªº®É¶¡,¥i¥H±oªŸTimer¹B§@¥¿±`,Šý§ÚWeb form€€ªºRepeater«ošSŠ³°µDataBind . §YšÏ«ežmªºProtected Sub,§ïŠšPublic
or Sharedµ²ªG³£¬O€@ŒË.

Šý§Ú€wªÖ©wRepeater1.DataBind()¬OšSŠ³°ÝÃD,°²Šp§Ú§â¥Š©ñŠbButton_clickªºEvent€€¬OšSŠ³°ÝÃDªº. Šbºô€W§äšì€@šÇÁ¿­zTimerªº€å³¹,
http://blog.joycode.com/percyboy/archive/2004/08/21/31240.aspx
«ošSŠ³ÀYºü,€j®a¥i¥HÀ°Š£¶Ü?



--
璉璉
2006-06-23 07:41:35 UTC
Permalink
§Aªº¥Øªº¬OšC€T¬í¿é¥X Start xxxx/xx/xx xx:xx:xx
ÁÙ¬O­nºô­¶­«Ÿã¡H
­nºô­¶­«ŸãœÐ¥Î script ³B²z
©ó news:uZm2cnhlGHA.4044%40TK2MSFTNGP03.phx.gbl µoªí
Dim aTimer As New System.Timers.Timer
AddHandler aTimer.Elapsed, AddressOf TimerEvent
aTimer.Interval = 3000
aTimer.Enabled = True
aTimer.AutoReset = True
Protected Sub TimerEvent(ByVal sender As Object, ByVal e As
System.Timers.ElapsedEventArgs)
Debug.Print("start" & Now )
Repeater1.DataBind()
Debug.Print("end" & Now )
End Sub
http://blog.joycode.com/percyboy/archive/2004/08/21/31240.aspx
«ošSŠ³ÀYºü,€j®a¥i¥HÀ°Š£¶Ü?
--
--
­·¬ê¬ì§ÞÅçÃÒŠ³­­€œ¥q ASP.NET Web News Reader 0.2.2 UTF-8 Beta
ºô¯žŠa¹Ï http://tlcheng.no-ip.com/wwwmap.htm
¬y°ìšŸ¬x/°Ï°ì€ôžê·œ/®}ª@ºô/ªŽºÀ¹Ï/»y­µ³q°T €å³¹»Pµ{Š¡
Basic/Fortran/Windows API/.Net/»²§U»¡©úÀÉ ­ì©lœX¡B€å³¹»P°Qœ×
Ž_¿³¥x¥_Ÿ÷³õ¶Q»««Ç
--
ASPNET News http://tlcheng.no-ip.com/News/ | http://tlcheng.twbbs.org/News/
RSS 2.0 http://tlcheng.no-ip.com/News/rss2.aspx?Action=List&Newsgroup=microsoft.public.tw.dotnet.framework.aspnet
TaTMiNG@HK
2006-06-23 18:08:20 UTC
Permalink
§Úªº¥Øªº¬O·QRepeater °µDatabindŠÓ€w
§ÚžÕ¹L¥ÎThreading¥h°µ¡AŠýµ²ªG³£¬O€@ŒË
Š³€H»¡§ÚÀ³žÓ¥ÎJavascriptªºSetTimeOut
Šý§Ú«o€£ªŸ¹DŠpŠóŠbJava Script Function€€©I¥sASP.NETªºSub
--
Post by 璉璉
§Aªº¥Øªº¬OšC€T¬í¿é¥X Start xxxx/xx/xx xx:xx:xx
ÁÙ¬O­nºô­¶­«Ÿã¡H
­nºô­¶­«ŸãœÐ¥Î script ³B²z
©ó news:uZm2cnhlGHA.4044%40TK2MSFTNGP03.phx.gbl µoªí
Dim aTimer As New System.Timers.Timer
AddHandler aTimer.Elapsed, AddressOf TimerEvent
aTimer.Interval = 3000
aTimer.Enabled = True
aTimer.AutoReset = True
Protected Sub TimerEvent(ByVal sender As Object, ByVal e As
System.Timers.ElapsedEventArgs)
Debug.Print("start" & Now )
Repeater1.DataBind()
Debug.Print("end" & Now )
End Sub
Public
http://blog.joycode.com/percyboy/archive/2004/08/21/31240.aspx
«ošSŠ³ÀYºü,€j®a¥i¥HÀ°Š£¶Ü?
--
--
­·¬ê¬ì§ÞÅçÃÒŠ³­­€œ¥q ASP.NET Web News Reader 0.2.2 UTF-8 Beta
ºô¯žŠa¹Ï http://tlcheng.no-ip.com/wwwmap.htm
Basic/Fortran/Windows API/.Net/»²§U»¡©úÀÉ ­ì©lœX¡B€å³¹»P°Qœ×
Ž_¿³¥x¥_Ÿ÷³õ¶Q»««Ç
--
ASPNET News http://tlcheng.no-ip.com/News/ |
http://tlcheng.twbbs.org/News/
RSS 2.0
http://tlcheng.no-ip.com/News/rss2.aspx?Action=List&Newsgroup=microsoft.public.tw.dotnet.framework.aspnet
璉璉
2006-06-25 06:07:58 UTC
Permalink
§A»Ý­n§â§A·Q­n°µªºšÆ¡Ažò§A«äŠÒ€WªºÅ޿軡²M·¡¡C
Client ¥»šÓŽN€£¯àªœ±µ©I¥s Server ºÝªºµ{Š¡œX¡C
©ó news:uW%23x2BvlGHA.4076%40TK2MSFTNGP05.phx.gbl µoªí
§Úªº¥Øªº¬O·QRepeater °µDatabindŠÓ€w
Š³€H»¡§ÚÀ³žÓ¥ÎJavascriptªºSetTimeOut
Šý§Ú«o€£ªŸ¹DŠpŠóŠbJava Script Function€€©I¥sASP.NETªºSub
--
Post by 璉璉
§Aªº¥Øªº¬OšC€T¬í¿é¥X Start xxxx/xx/xx xx:xx:xx
ÁÙ¬O­nºô­¶­«Ÿã¡H
­nºô­¶­«ŸãœÐ¥Î script ³B²z
©ó news:uZm2cnhlGHA.4044%40TK2MSFTNGP03.phx.gbl µoªí
Dim aTimer As New System.Timers.Timer
AddHandler aTimer.Elapsed, AddressOf TimerEvent
aTimer.Interval = 3000
aTimer.Enabled = True
aTimer.AutoReset = True
Protected Sub TimerEvent(ByVal sender As Object, ByVal e As
System.Timers.ElapsedEventArgs)
Debug.Print("start" & Now )
Repeater1.DataBind()
Debug.Print("end" & Now )
End Sub
Public
http://blog.joycode.com/percyboy/archive/2004/08/21/31240.aspx
«ošSŠ³ÀYºü,€j®a¥i¥HÀ°Š£¶Ü?
--
--
­·¬ê¬ì§ÞÅçÃÒŠ³­­€œ¥q ASP.NET Web News Reader 0.2.2 UTF-8 Beta
ºô¯žŠa¹Ï http://tlcheng.no-ip.com/wwwmap.htm
¬y°ìšŸ¬x/°Ï°ì€ôžê·œ/®}ª@ºô/ªŽºÀ¹Ï/»y­µ³q°T €å³¹»Pµ{Š¡
Basic/Fortran/Windows API/.Net/»²§U»¡©úÀÉ ­ì©lœX¡B€å³¹»P°Qœ×
--
ASPNET News http://tlcheng.no-ip.com/News/ | http://tlcheng.twbbs.org/News/
RSS 2.0 http://tlcheng.no-ip.com/News/rss2.aspx?Action=List&Newsgroup=microsoft.public.tw.dotnet.framework.aspnet
unknown
2006-06-28 00:57:02 UTC
Permalink
[Repeater 做Databind]這個動作需要timer?????
我的目的是想Repeater 做Databind而已
我試過用Threading去做,但結果都是一樣
有人說我應該用Javascript的SetTimeOut
但我卻不知道如何在Java Script Function中呼叫ASP.NET的Sub
--
你的目的是每三秒輸出 Start xxxx/xx/xx xx:xx:xx
還是要網頁重整?
要網頁重整請用 script 處理
於 news:uZm2cnhlGHA.4044%40TK2MSFTNGP03.phx.gbl 發表
Dim aTimer As New System.Timers.Timer
AddHandler aTimer.Elapsed, AddressOf TimerEvent
aTimer.Interval = 3000
aTimer.Enabled = True
aTimer.AutoReset = True
Protected Sub TimerEvent(ByVal sender As Object, ByVal e As
System.Timers.ElapsedEventArgs)
Debug.Print("start" & Now )
Repeater1.DataBind()
Debug.Print("end" & Now )
End Sub
在輸出視窗中,都可以看出Debug.Print的Start 和End 和Now的時間,可以得知Timer運作正常,但我Web form中的Repeater卻沒有做DataBind . 即使前置的Protected Sub,改成
Public
or Shared結果都是一樣.
但我已肯定Repeater1.DataBind()是沒有問題,假如我把它放在Button_click的Event中是沒有問題的. 在網上找到一些講述Timer的文章,
http://blog.joycode.com/percyboy/archive/2004/08/21/31240.aspx
卻沒有頭緒,大家可以幫忙嗎?
--
--
風禹科技驗證有限公司 ASP.NET Web News Reader 0.2.2 UTF-8 Beta
網站地圖 http://tlcheng.no-ip.com/wwwmap.htm
流域防洪/區域水資源/徐昇網/玫瑰圖/語音通訊 文章與程式
Basic/Fortran/Windows API/.Net/輔助說明檔 原始碼、文章與討論
復興台北機場貴賓室
--
ASPNET News http://tlcheng.no-ip.com/News/ |
http://tlcheng.twbbs.org/News/
RSS 2.0
http://tlcheng.no-ip.com/News/rss2.aspx?Action=List&Newsgroup=microsoft.public.tw.dotnet.framework.aspnet
继续阅读narkive:
Loading...