[CLOSED] first alert a message then a few second later(3 second) redirect to another url?

  1. #1

    [CLOSED] first alert a message then a few second later(3 second) redirect to another url?

    first alert a message then a few second later(3 second) redirect to another url?
    how to do this using ext.net?
    Last edited by Daniil; Apr 15, 2014 at 11:16 PM. Reason: [CLOSED]
  2. #2
    Quote Originally Posted by hdsoso View Post
    first alert a message then a few second later(3 second) redirect to another url?
    how to do this using ext.net?
    There are options. The following sample demonstrates one technique.

    Example

    <%@ Page Language="C#" %>
    
    <script runat="server">
        protected void Button1_Click(object el, DirectEventArgs e)
        {
            X.Msg.Alert("Title", "Hello World").Show();
    
            X.AddScript(@"Ext.Function.defer(function () {
                            window.location = 'somewhere.aspx';
                        }, 3000);");
        }
    </script>
    
    <!DOCTYPE html>
    
    <html>
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
    
            <ext:Button runat="server" Text="Submit" OnDirectClick="Button1_Click" />
        </form>
    </body>
    </html>
    Hope this helps.
    Geoffrey McGill
    Founder
  3. #3
    We have added new a new X.Defer() Method and .Defer functionality to the JFunction class.

    If you update from Svn, or the upcoming 2.5.1 release, all the following functionality will be enabled.

    Example

    <%@ Page Language="C#" %>
    
    <script runat="server">
        protected void Button1_Click(object el, DirectEventArgs e)
        {
            // Option 1 - New X.Defer() Method
            // Pass in a Hander, or client-side Function name, and the delay value in Milliseconds
    
            var handler = "window.location = 'default.aspx';";
            
            X.Defer(handler, 3000);
    
            
            // Option 2 = New X.Defer() Method with client-side function name
            // Pass in a client-side function name, and the specify the delay in Milliseconds
    
            var fn = "doSomething";
            
            X.Defer(fn, 3000);
            
            
            // Option 3 - New X.Defer() Method JFunction
            // Pass a JFunction to .Defer, and specify the delay in Milliseconds        
            var func = new JFunction
            {
                Handler = @"window.location = 'default.aspx';"
            };
    
            X.Defer(func, 3000);
    
            
            // Option 4 - Call .Defer on a JFunction
            new JFunction
            {
                Handler = "window.location = 'default.aspx';"
            }.Defer(3000);
        }
    </script>
    
    <!DOCTYPE html>
    
    <html>
    <head runat="server">
        <title>Ext.NET Example</title>
    
        <script type="text/javascript">
            var doSomething = function () {
                window.location = 'default.aspx';
            };
        </script>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
    
            <ext:Button runat="server" Text="Submit" OnDirectClick="Button1_Click" />
        </form>
    </body>
    </html>
    Hope this helps.
    Geoffrey McGill
    Founder

Similar Threads

  1. [CLOSED] Differences between X.Redirect and Response.Redirect
    By SouthDeveloper in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: May 10, 2012, 4:29 PM
  2. [CLOSED] Alert Message contorl
    By speedstepmem3 in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Jun 11, 2010, 12:55 PM
  3. alert vs Ext.Msg.alert + window.location
    By Nime in forum 1.x Help
    Replies: 0
    Last Post: Nov 10, 2009, 3:34 AM
  4. Message alert in the GridPanel
    By flaviodamaia in forum 1.x Help
    Replies: 1
    Last Post: Aug 28, 2009, 5:58 PM
  5. Message alert in the .cs
    By flaviodamaia in forum 1.x Help
    Replies: 4
    Last Post: Jan 21, 2009, 2:53 PM

Posting Permissions