Using C# to redirect one form to another after a specific task completes

Discussion in 'ASP .Net' started by Brian Gordaychik, Dec 2, 2004.

  1. Hey all,
    I have a web application which loads a wizard (another smaller form to
    get user info). As soon as the wizard completes, I need to have the
    original page from which the wizard was called from redirect to a new
    page based on the users input.

    I've tried using a seperate thread and a lock to wait until the wizard
    finishes, but I cannot do a Response.Redirect() from the second
    thread.

    Does anyone have any ideas? Thanks,
    Brian Gordaychik
    (bpg24 -at- drexel -dot- edu)
     
    Brian Gordaychik, Dec 2, 2004
    #1
    1. Advertisements

  2. Brian Gordaychik

    WJ Guest

    The reliable method (works for me so far) is to keep passing the original
    Url (the 1st caller) to each step. The last step would then have it and
    redirect to the orginal caller (the 1st caller if I understand it
    correctly). Example: You start out with http://mySite.com.Default.Aspx. This
    will call Page1Wizard.Aspx with its Url, Page1 then passes to Page2Wizard
    and so on.... The last page will do something like this:

    1. On its onPageLoad event, you do string
    OriginalUrl=Request["FirstCaller"];\
    2. Response.Redirect(OriginalUrl);

    John
     
    WJ, Dec 2, 2004
    #2
    1. Advertisements

  3. Brian Gordaychik

    bruce barker Guest

    you can use client script to do this. the subform can update it parents
    (window.opener) location.

    -- bruce (sqlwork.com)


    | Hey all,
    | I have a web application which loads a wizard (another smaller form to
    | get user info). As soon as the wizard completes, I need to have the
    | original page from which the wizard was called from redirect to a new
    | page based on the users input.
    |
    | I've tried using a seperate thread and a lock to wait until the wizard
    | finishes, but I cannot do a Response.Redirect() from the second
    | thread.
    |
    | Does anyone have any ideas? Thanks,
    | Brian Gordaychik
    | (bpg24 -at- drexel -dot- edu)
     
    bruce barker, Dec 2, 2004
    #3
  4. No, that would be simple... maybe I'm not being clear. After the
    wizard completes, I want to have the page that called the wizard
    redirect to some page. But I only want that to happen once they click
    the finish button on the wizard page. I don't want to simply redirect
    the window that contains the wizard. Any ideas? Thanks,
    Brian
     
    Brian Gordaychik, Dec 3, 2004
    #4
  5. Is the original page still being shown in another window? If so, then you'd
    need to use JavaScript to have the first window detect when the Wizard
    window closes. The first window would then use JavaScript to do the
    redirect.

    John Saunders
     
    John Saunders, Dec 3, 2004
    #5
  6. Brian Gordaychik

    gordy Guest

    Thats the question, how do I do that with javascript then? Has anyone
    done this before and could possibly show me some code? I was thinking
    of using 2 different threads in c#, that way I could pend until the
    wizard is complete, but that method won't work.
    -Brian
     
    gordy, Dec 6, 2004
    #6
  7. Brian, I'm not a JavaScript expert and don't have any code for this. But I
    should remind you - this is all client-side stuff. It has nothing to do with
    extra threads or C#.

    You should consider getting this to work with two .html pages - one to play
    the calling page and one to play the wizard. Figure out how to make the
    calling page wait until the wizard is done, then redirect somewhere. Once
    you get that done, you just have to get the same JavaScript on you .aspx
    pages.

    John Saunders
     
    John Saunders, Dec 6, 2004
    #7
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.