Another basic question: How to call and show one Web Form from another Web Form?

Discussion in 'ASP .Net Web Controls' started by Rob R. Ainscough, Jun 13, 2005.

  1. I'm new to ASP.NET and Web Development (Primarily a VB6, VB.NET, SQL Server
    developer).

    I've got an ASP.NET Form (Web Form) that contains various info/controls.
    One of these controls is a "Continue" button. I want to load another
    ASP.NET Web Form in my project when the "Continue" button is pressed.

    I can add VB.NET code to the bn_Continue_Click event such as:

    Private Sub bn_Continue_Click(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles bn_Continue.Click

    Dim MyWebForm As New AWebForm

    ' What do I use to load MyWebForm in the current browser window?

    End Sub

    This is very basic, but I've read two ASP.NET books and searched for a
    solution and so far all seem to require HTML based coding that loads the
    AWebForm.aspx in a separate browser window (which is NOT what I want)?

    Also, am I being unrealistic in wanting to NOT keep resorting back to HTML
    coding? I find the HTML syntax mind boggling, difficult and time consuming
    to sift thru, and just very confusing and verly syntax heavy.

    Thanks, Rob.
     
    Rob R. Ainscough, Jun 13, 2005
    #1
    1. Advertising

  2. You can do it with one line of code, such as these:

    Response.Redirect("WebForm2.aspx")
    'or
    Server.Transfer("WebForm2.aspx")

    --
    I hope this helps,
    Steve C. Orr, MCSD, MVP
    http://SteveOrr.net


    "Rob R. Ainscough" <> wrote in message
    news:...
    > I'm new to ASP.NET and Web Development (Primarily a VB6, VB.NET, SQL
    > Server developer).
    >
    > I've got an ASP.NET Form (Web Form) that contains various info/controls.
    > One of these controls is a "Continue" button. I want to load another
    > ASP.NET Web Form in my project when the "Continue" button is pressed.
    >
    > I can add VB.NET code to the bn_Continue_Click event such as:
    >
    > Private Sub bn_Continue_Click(ByVal sender As System.Object, ByVal e As
    > System.EventArgs) Handles bn_Continue.Click
    >
    > Dim MyWebForm As New AWebForm
    >
    > ' What do I use to load MyWebForm in the current browser window?
    >
    > End Sub
    >
    > This is very basic, but I've read two ASP.NET books and searched for a
    > solution and so far all seem to require HTML based coding that loads the
    > AWebForm.aspx in a separate browser window (which is NOT what I want)?
    >
    > Also, am I being unrealistic in wanting to NOT keep resorting back to HTML
    > coding? I find the HTML syntax mind boggling, difficult and time
    > consuming to sift thru, and just very confusing and verly syntax heavy.
    >
    > Thanks, Rob.
    >
    >
    >
    >
     
    Steve C. Orr [MVP, MCSD], Jun 13, 2005
    #2
    1. Advertising

  3. Rob,

    As Steve has pointed out you can use on of the above two methods. One
    thing that you may want to consider is the use of panels. Panels
    simply provide an alternative to the splitting of pages and can offer a
    wizard style approach in a single page. For instance, let's say that
    you have two panels. The first panel contains a form where users fill
    out their personal information. This panel is set to visible and has a
    continue button on it.

    Panel2 contains employment information that the user will fill out.
    This panel is initially marked with its visible property as false.

    Once the user fills in their personal information and clicks the
    continue button, you could simply do:

    Panel1.Visible = False
    Panel2.Visible = True

    Thus hiding the personal information panel and showing the employment
    information panel.

    Again, this might not be desired, but I wanted to offer you an
    alternative that I have found helpful when designing Web applications.

    Aaron
     
    Aaron Corcoran, Jun 14, 2005
    #3
  4. Steve & Aaron,

    Thank you for the response, yes the Response.Redirect works great!

    I was thinking of using panels, but the processing I'm going thru requires
    some pages that require more than a Panel can offer (in terms of physical
    readability).

    ASP.NET and Web development is all new to me, so I've got this love/hate
    thing going on with it :)

    Rob.

    "Aaron Corcoran" <> wrote in message
    news:...
    > Rob,
    >
    > As Steve has pointed out you can use on of the above two methods. One
    > thing that you may want to consider is the use of panels. Panels
    > simply provide an alternative to the splitting of pages and can offer a
    > wizard style approach in a single page. For instance, let's say that
    > you have two panels. The first panel contains a form where users fill
    > out their personal information. This panel is set to visible and has a
    > continue button on it.
    >
    > Panel2 contains employment information that the user will fill out.
    > This panel is initially marked with its visible property as false.
    >
    > Once the user fills in their personal information and clicks the
    > continue button, you could simply do:
    >
    > Panel1.Visible = False
    > Panel2.Visible = True
    >
    > Thus hiding the personal information panel and showing the employment
    > information panel.
    >
    > Again, this might not be desired, but I wanted to offer you an
    > alternative that I have found helpful when designing Web applications.
    >
    > Aaron
    >
     
    Rob R. Ainscough, Jun 14, 2005
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. loveNUNO
    Replies:
    2
    Views:
    967
    loveNUNO
    Nov 20, 2003
  2. Replies:
    5
    Views:
    801
    Steve C. Orr [MCSD, MVP, CSM, ASP Insider]
    Jun 12, 2007
  3. Aussie Rules
    Replies:
    6
    Views:
    481
    Steven Cheng[MSFT]
    Aug 15, 2007
  4. A. Sinan Unur
    Replies:
    4
    Views:
    133
    Chris Page
    May 11, 2005
  5. Replies:
    1
    Views:
    217
    Keith Keller
    Mar 21, 2006
Loading...

Share This Page