首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

Timer的有关问题,知道的快来拣分啦:)

2012-01-02 
Timer的问题,知道的快来拣分啦:)我照网上的例子做的代码如下,可是Timer里的事件好像根本没发生啊,结果就是

Timer的问题,知道的快来拣分啦:)
我照网上的例子做的代码如下,可是Timer里的事件好像根本没发生啊,结果就是在UpdatePanel   里的LabelIn   内容不发生改变
例子的原型是在http://www.cnblogs.com/Terrylee/archive/2006/11/14/Introduction_to_the_Timer_Control.html   里

下面是我的代码

<html   xmlns= "http://www.w3.org/1999/xhtml "   >
<head   runat= "server ">
        <title> 无标题页 </title>
</head>
<body>
        <form   id= "form1 "   runat= "server ">
        <div>
                <asp:ScriptManager   ID= "ScriptManager1 "   EnablePartialRendering= "true "   runat= "server ">
                </asp:ScriptManager>
                <asp:UpdatePanel   ID= "UpdatePanel1 "   runat= "server ">
                        <ContentTemplate>
                                <asp:Timer   ID= "Timer1 "   runat= "server "   Interval= "10000 "   OnTick= "Timer1_Tick ">
                                </asp:Timer>
                                <asp:Label   ID= "LabelIn "   runat= "server "   Text= "Label   Display "> </asp:Label>
                        </ContentTemplate>
                        <Triggers>
                                <asp:AsyncPostBackTrigger   ControlID= "Timer1 "   />
                        </Triggers>
                </asp:UpdatePanel>
       
        </div>
                &nbsp;   &nbsp;&nbsp;&nbsp;
                <asp:Label   ID= "LabelOut "   runat= "server "   Text= "Label   "> </asp:Label>
        </form>
</body>
</html>

--------------------
Partial   Class   Temp
        Inherits   System.Web.UI.Page

        Protected   Sub   Timer1_Tick(ByVal   sender   As   Object,   ByVal   e   As   System.EventArgs)
                LabelIn.Text   =   DateTime.Now.ToLongTimeString
        End   Sub

        Protected   Sub   Page_Load(ByVal   sender   As   Object,   ByVal   e   As   System.EventArgs)   Handles   Me.Load
                LabelOut.Text   =   DateTime.Now.ToLongTimeString


        End   Sub
End   Class

[解决办法]
up
[解决办法]
vs2005有timer吗?
[解决办法]
Timer.Start();
...
Timer.End();

热点排行