Home All Groups Group Topic Archive Search About

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

Author
13 Jun 2005 10:04 PM
Rob R. Ainscough
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.

Author
13 Jun 2005 10:39 PM
Steve C. Orr [MVP, MCSD]
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


Show quoteHide quote
"Rob R. Ainscough" <roba***@pacbell.net> wrote in message
news:eAREJOGcFHA.2212@TK2MSFTNGP14.phx.gbl...
> 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.
>
>
>
>
Author
14 Jun 2005 12:41 PM
Aaron Corcoran
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
Author
14 Jun 2005 3:56 PM
Rob R. Ainscough
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.

Show quoteHide quote
"Aaron Corcoran" <acorco***@lasers.state.la.us> wrote in message
news:1118752892.458358.142200@g14g2000cwa.googlegroups.com...
> 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
>