Results 1 to 14 of 14

Thread: Show a "thank you" page for only 15 seconds

  1. #1

    Thread Starter
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Show a "thank you" page for only 15 seconds

    After the user types in an application on a webpage - they click SUBMIT - we save the data.

    We then go to a Thank You page.

    This Thank You page has a button for "LOAD ANOTHER APPLICATION" that returns to the prior page.

    I would like to make it so that after 15 seconds of being on the THANK YOU page it goes to the APPLICATION page automatically.

    Is this possible?

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  2. #2
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Show a "thank you" page for only 15 seconds

    Hey,

    You could do this in a couple ways.

    1) A quick and dirty way - refresh tag in head element:

    http://en.wikipedia.org/wiki/Meta_refresh

    2) A more correct way, send Redirect Response to the page:
    Code:
    <script runat="server">
    private void Page_Load(object sender, System.EventArgs e)
    {
    Response.Status = "301 Moved Permanently";
    Response.AddHeader("Location","<your new url>");
    }
    </script>
    Hope that helps!!

    Gary

  3. #3

    Thread Starter
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Show a "thank you" page for only 15 seconds

    How would the "more correct" way be done after a 15 second pause?

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  4. #4
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Show a "thank you" page for only 15 seconds

    Hey,

    You could use a timer, but I tend to shy away from Timers in ASP.Net.

    The other way would be to use a setTimeout on the Client and then do the redirect on the client, but then I tend to shy away from setTimeout as well.

    That doesn't really help, does it

    Gary

  5. #5
    VB Addict Pradeep1210's Avatar
    Join Date
    Apr 2004
    Location
    Inside the CPU...
    Posts
    6,614

    Re: Show a "thank you" page for only 15 seconds

    You can put the asp.net timer and set the interval property appropriately. Then you can check IsPostBack=True on server side and Response.Redirect to the new page accordingly.

    If for any reason you can't put the asp.net timer control, you can construct a javascript timer.
    Here is a way how to do it.
    (not tested code. may need tweaking)
    Code:
    <head>
        <!-- head goes here -->
        <script language="JavaScript" type="text/javascript">
            var secs = 15;
            var timer;
            function SetTimer() {
                if (secs <= 0) {
                    clearTimeout(timer);
                    document.form.whatever.submit();
                }
                else {
                    secs--;
                    timer = self.setTimeout("SetTimer()", 1000);
                }
            }
        </script>
    </head>
    <body onload="SetTimer()">
            <form id="whatever" method="post" runat="server">
                <!-- Body goes here -->
            </form>
        </body>
    </html>
    This would postback automatically after 15 seconds have elapsed. On the server-side you can check IsPostBack=True on server side and Response.Redirect to the new page accordingly.
    Last edited by Pradeep1210; Oct 22nd, 2009 at 06:59 AM.
    Pradeep, Microsoft MVP (Visual Basic)
    Please appreciate posts that have helped you by clicking icon on the left of the post.
    "A problem well stated is a problem half solved." — Charles F. Kettering

    Read articles on My Blog101 LINQ SamplesJSON ValidatorXML Schema Validator"How Do I" videos on MSDNVB.NET and C# ComparisonGood Coding PracticesVBForums Reputation SaverString EnumSuper Simple Tetris Game


    (2010-2013)
    NB: I do not answer coding questions via PM. If you want my help, then make a post and PM me it's link. If I can help, trust me I will...

  6. #6

    Thread Starter
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Show a "thank you" page for only 15 seconds

    Why does this client keep asking for things like this...

    We already use JS for stuff - so I guess the JS timer makes sense.

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  7. #7
    Hyperactive Member dnanetwork's Avatar
    Join Date
    Oct 2007
    Location
    Mumbai
    Posts
    349

    Re: Show a "thank you" page for only 15 seconds

    Code:
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Untitled Page</title>
        <script type="text/javascript" language="javascript">
        function callme()
        {
        exforsys = setTimeout("alert('Dude you are getting redirected to tatadocomo');window.location='http://create.tatadocomo.com'",5000);  
        }
        </script>
    </head>
    <body onload="callme();">
        <form id="form1" runat="server">
        <div>
        </div>
        </form>
    </body>
    </html>
    i have tested this code...

    hope this helps..

    gary i'm big fan of yours..

    your idea is good but we need to use timer

    but this time i'm not impressed..

  8. #8

    Thread Starter
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Show a "thank you" page for only 15 seconds

    How do I put that into a page with a master page?

    Code:
    <%@ Page Title="Vendor Thank You" Language="VB" MasterPageFile="~/StyleAndAuth.master" AutoEventWireup="false" CodeFile="FinishApp.aspx.vb" Inherits="Vendors_FinishApp" %>
    
    <asp:Content ID="Content1" ContentPlaceHolderID="HeaderPlaceHolder" Runat="Server">
        <table width="1000">
    <tr>
    <td align="left" width="20%">
    <asp:Label ID="HomeLbl" runat="server" ForeColor="Black" Text="Client Home" 
            Font-Size="Small"></asp:Label>
    </td>
    <td align="center" width="60%">
     <asp:Label ID="WelcomeLbl" runat="server" ForeColor="Black" 
            Style="position: relative;" Text="Client Home" Font-Size="Small"></asp:Label>
    </td>
    <td align="right"  width="20%" >
    <asp:LoginStatus ID="LoginStatus1" runat="server" 
            LogoutPageUrl="~/Login.aspx" Font-Size="Small" Font-Underline="True" 
            ForeColor="Black" />
    </td>
    </tr>
    </table>
    </asp:Content>
    
    <asp:Content ID="Content2" ContentPlaceHolderID="BodyPlaceHolder" Runat="Server">
        <div style="text-align:center; width:984px;">
    
    
            <!-- Project / File Info -->
            <div align="left">
                <div style="text-align:Left">
                    <b><br />
                    <asp:Label ID="Label15" runat="server" ForeColor="ForestGreen" Text="Vendor Application" Width="100%"></asp:Label><br />
                    </b>
                </div>
            </div>
    
            <div style="background-color:#eeeeee; text-align:left; padding-left: 5px">
                <div style="text-align:center; vertical-align:middle; width:100%; background-color:#eeeeee;" >
                    <br />
                    <br />
                    <br />
                    <br />
                    <br />
                    <br />
                    <br />
                    <b>
                    Thank you for your Application!</b><br />
                    <br />
                    <br />
                    <br />
                    <br />
                    <br />
                    <br />
                    <br />
                    <br />
                    <b><asp:Button ID="SubmitProject" runat="server" Text="Begin New Application" Width="175px" Style="background-color:Lime"/></b>
                    <br />
                    <br />
                </div>
                Vendor Id: <asp:Label ID="VendorId" runat="server"></asp:Label>
                <br />
            </div>
        </div>
    </asp:Content>

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  9. #9
    VB Addict Pradeep1210's Avatar
    Join Date
    Apr 2004
    Location
    Inside the CPU...
    Posts
    6,614

    Re: Show a "thank you" page for only 15 seconds

    I think it won't matter. Just add that Javascript block at the end of the page.
    Code:
        <script language="JavaScript" type="text/javascript">
            var secs = 15;
            var timer;
            function SetTimer() {
                if (secs <= 0) {
                    clearTimeout(timer);
                    document.form.whatever.submit();
                    // or set window.location = "some url" if postback is not required.
                }
                else {
                    secs--;
                    timer = self.setTimeout("SetTimer()", 1000);
                }
            }
        </script>
    @dnanetwork: working too hard on client/server codes these days, I just forgot that we can simply redirect using javascript.
    Last edited by Pradeep1210; Oct 22nd, 2009 at 07:00 AM.
    Pradeep, Microsoft MVP (Visual Basic)
    Please appreciate posts that have helped you by clicking icon on the left of the post.
    "A problem well stated is a problem half solved." — Charles F. Kettering

    Read articles on My Blog101 LINQ SamplesJSON ValidatorXML Schema Validator"How Do I" videos on MSDNVB.NET and C# ComparisonGood Coding PracticesVBForums Reputation SaverString EnumSuper Simple Tetris Game


    (2010-2013)
    NB: I do not answer coding questions via PM. If you want my help, then make a post and PM me it's link. If I can help, trust me I will...

  10. #10

    Thread Starter
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Show a "thank you" page for only 15 seconds

    Not allowed outside content panels error (or something like that).

    I see from another page that there is a script manager - is that required for JS on pages with Master pages?

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  11. #11
    VB Addict Pradeep1210's Avatar
    Join Date
    Apr 2004
    Location
    Inside the CPU...
    Posts
    6,614

    Re: Show a "thank you" page for only 15 seconds

    okk I see. So the best way I see is to add a ContentPlaceHolder in your StyleAndAuth.master, somewhere inside the <head></head> tags.
    So then in this page, you can put it inside that place holder, like you have done for these two.
    Pradeep, Microsoft MVP (Visual Basic)
    Please appreciate posts that have helped you by clicking icon on the left of the post.
    "A problem well stated is a problem half solved." — Charles F. Kettering

    Read articles on My Blog101 LINQ SamplesJSON ValidatorXML Schema Validator"How Do I" videos on MSDNVB.NET and C# ComparisonGood Coding PracticesVBForums Reputation SaverString EnumSuper Simple Tetris Game


    (2010-2013)
    NB: I do not answer coding questions via PM. If you want my help, then make a post and PM me it's link. If I can help, trust me I will...

  12. #12

    Thread Starter
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Show a "thank you" page for only 15 seconds

    I was just starting to understand how that MP stuff is working. I had a web-coder over the summer research most of this and then implement it.

    So - you are saying that I can add a content placeholder to the MASTER page and all existing pages that reference the MASTER - but do not invoke this new content placeholder - will still work??

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  13. #13
    VB Addict Pradeep1210's Avatar
    Join Date
    Apr 2004
    Location
    Inside the CPU...
    Posts
    6,614

    Re: Show a "thank you" page for only 15 seconds

    Yes, that's right.
    You can add a content placeholder in the master page. So if you need to place something at that place on your page, you just put them in the appropriate <asp:Content></asp:Content> in your child pages. This is optional. If you do not place any of them in your child pages, they do not render (or render with whatever default you have placed in the master page if any).
    Pradeep, Microsoft MVP (Visual Basic)
    Please appreciate posts that have helped you by clicking icon on the left of the post.
    "A problem well stated is a problem half solved." — Charles F. Kettering

    Read articles on My Blog101 LINQ SamplesJSON ValidatorXML Schema Validator"How Do I" videos on MSDNVB.NET and C# ComparisonGood Coding PracticesVBForums Reputation SaverString EnumSuper Simple Tetris Game


    (2010-2013)
    NB: I do not answer coding questions via PM. If you want my help, then make a post and PM me it's link. If I can help, trust me I will...

  14. #14
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Show a "thank you" page for only 15 seconds

    Hey,

    Would another alternative not be to inject the JavaScript onto the page:

    http://msdn.microsoft.com/en-us/library/btf44dc9.aspx

    Gary

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width