<%@ Page Language="C#" AutoEventWireup="true" CodeFile="DelayEvent.aspx.cs" Inherits="Events_DirectEvents_DelayEvent" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>延时</title>
<script runat="server">
protected void DelayEvent(object sender, DirectEventArgs e)
{
X.Msg.Notify("老虞说", "你好").Show();
}
</script>
<script type="text/javascript">
var beforeMthod=function(element,extraParams)
{
var date=new Date();
Ext.Msg.alert('时间',
"提交时间:"+Ext.getCmp("LocalTimeLabel").getText()+"<br/>"+
"当前时间:"+TimeDemo(date));
}
function TimeDemo(date){
var d, s ="";
var c = ":";
if(date)
d =date;
else
d=new Date();
s += d.getHours() + c;
s += d.getMinutes() + c;
s += d.getSeconds() + c;
s += d.getMilliseconds();
return(s);
}
</script>
</head>
<body>
<!--
Delay 延时毫秒数
-->
<form id="form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server">
</ext:ResourceManager>
<ext:Button ID="Button3" runat="server" Text="提交">
<DirectEvents>
<Click Delay="5000" OnEvent="DelayEvent" CleanRequest="false" Before="beforeMthod">
</Click>
</DirectEvents>
<Listeners>
<Click Handler="#{TaskManager1}.stopAll();" />
</Listeners>
</ext:Button>
<ext:TaskManager ID="TaskManager1" runat="server">
<Tasks>
<ext:Task>
<Listeners>
<Update Handler="#{LocalTimeLabel}.setText(TimeDemo());" />
</Listeners>
</ext:Task>
</Tasks>
</ext:TaskManager>
<ext:Label ID="LocalTimeLabel" runat="server">
</ext:Label>
</form>
</body>
</html>
Technorati 标签:
Ext.Net