Hello,
is it possible to show a MessageBox on clientside with a given delay? For example delay="5000"?
Regards,
Martin
Printable View
Hello,
is it possible to show a MessageBox on clientside with a given delay? For example delay="5000"?
Regards,
Martin
Hello, macap!
Please look at two ways to do it.
You can useCode:<!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 id="Head1" runat="server">
<title>Ext.NET Example</title>
</head>
<body>
<ext:ResourceManager ID="ResourceManager1" runat="server" ScriptMode="Debug"/>
<form id="Form1" runat="server">
<ext:Button runat="server" Text="MessageBox with using Delay property">
<Listeners>
<Click Handler="Ext.Msg.alert('Some title','Some message');" Delay="5000"/>
</Listeners>
</ext:Button>
<ext:Button runat="server" Text="MessageBox with using setTimeout function">
<Listeners>
<Click Handler="setTimeout(function() {Ext.Msg.alert('Some title','Some message');}, 5000);"/>
</Listeners>
</ext:Button>
</form>
</body>
</html>
at any place of JavaScript code.Code:setTimeout(function() {Ext.Msg.alert('Some title','Some message');}, 5000);
Also you can use the defer function that defined in the ExtJS Function class.
http://www.sencha.com/deploy/dev/docs/?class=Function
Code:<!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 id="Head1" runat="server">
<title>Ext.NET Example</title>
<script type="text/javascript">
var showMessage = function() {
Ext.Msg.alert('Some title', 'Some message');
}
</script>
</head>
<body>
<ext:ResourceManager ID="ResourceManager1" runat="server" ScriptMode="Debug"/>
<form id="Form1" runat="server">
<ext:Button ID="Button1" runat="server" Text="MessageBox with using defer">
<Listeners>
<Click Handler="showMessage.defer(5000);"/>
</Listeners>
</ext:Button>
</form>
</body>
</html>
Here's another .defer option. I just happen to be working on almost this exact line of code when I read this thread.
Enables all code in a single line without having to call a custom js function.
Example
Hope this helps.Code:<Click Handler="Ext.Msg.alert.defer(5000, Ext.Msg, ['your title', 'your message']);"/>