Results 1 to 6 of 6

Thread: Using multiple web forms

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2001
    Location
    Bay Area, California
    Posts
    9

    Using multiple web forms

    My application opens a second web form to do calculations. I use Response.Redirect to open the second page.

    When returning to the first page, I need all the values to be retained. In order to do this, the Return button (btnClose) in the second form uses this in Page_Load:

    Code:
    btnClose.Attributes.Add("onClick", "javascript:history.back(); return false;")
    This makes btnClose work as if the user clicked the back button.

    This works great except for one thing. Once returning to to the first web page, a click on any button re-opens the previous, second web form.

    I am sure that there is a better way to do this, I can open the second page as a pop-up using JaveScript. This leaves the first page open, which is great. But what I cannot figure out is how to close the second page after being done with it.

    Any help would be greatly appreciated!

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    23,246

    Re: Using multiple web forms

    You're asking in the desktop forum. Try the ASP.Net forum...

    http://www.vbforums.com/forumdisplay...d-ASP-NET-Core

  3. #3
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    105,018

    Re: Using multiple web forms

    Quote Originally Posted by .paul. View Post
    You're asking in the desktop forum. Try the ASP.Net forum...

    http://www.vbforums.com/forumdisplay...d-ASP-NET-Core
    I have already asked the mods to move this thread to that forum, so please don't create a duplicate thread.

    That said, the VB.NET forum is not for desktop apps specifically. If a question relates to code in a web app but it is about VB.NET generally, e.g. string manipulation or data access, then this is still an appropriate place for it. If the question is specific to ASP.NET though, e.g. relates to JavaScript as well as VB.NET, then the dedicated ASP.NET forum is the place for it.

  4. #4
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    23,246

    Re: Using multiple web forms

    Ok vb general, but mostly desktop...

  5. #5
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,441

    Re: Using multiple web forms

    Thread moved to the 'ASP.Net' forum, which is where questions about .Net web pages etc belong

  6. #6
    Lively Member
    Join Date
    Jan 2020
    Posts
    81

    Re: Using multiple web forms

    Hello,@thorskonnord

    It is indeed a shortcoming of WebForms. In ASP.NET MVC you can implement as many forms as you want (and it is valid & correct behavior of web pages).

    The reason all server controls are placed inside <form> tag is to allow the WebForms engine to recognize them, load their values & save their values from/to the ViewState. Almost all infrastructure of control management in WebForms is based on the idea that a tag contains everything you access from the code-behind.


    I hope this information will be useful.
    Thank you.

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