Simple ASP.NET Forms Question ASP Migration

J

jm

I have a .net form. based upon data submitted, another should page is
called (I think), sent the arguments, etc. I see I cannot use the
action= argument like old asp. so how do i call the other page with
the arguments?

What is the model here - coming from old ASP. Thank you.
 
S

S. Justin Gengo

jm,

You have three choices:

1. You could Response.Redirect to the new page and include the data in the
querystring.

2. You could use Server.Transfer to move to the next page. Server.Transfer
allows you to keep any posted querystring or form data intact as you call
another page. It's also faster than a response.redirect because instead of
the server sending the client browser a command to change pages the old page
is just swapped out for the new one. However, this means that if you
Server.Transfer a user from page1.aspx to page2.aspx in the browser's
address bar the user will still see the address as page1.aspx because the
browser has no way of knowing that page2.aspx was returned instead.

Here is a good article that explains one good way to use Server.Transfer:

http://aspnet.4guysfromrolla.com/articles/050802-1.aspx

3. Yet another way to handle things is to not transfer to another page at
all. Instead of using separate pages you place Panels on your main page.
Each panel takes the place of a page you would have posted data to. Hide all
the panels except the main one to begin with by setting their visibility
properties to False. Then when a link or button is clicked in a panel set
that panel's visibility property to False and the visibility property of the
new panel to display to True. Using this technique you constantly have
access to all object in every panel and can simulate movement from one page
to another all on a single page.


--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
 
S

Scott M.

Hi Jim,

In .NET the form submission paradigm has changed to a one (self-calling)
page sytem.

You can then use the Page object's "IsPostBack" method to determine if the
form has been submitted before. This lets you know when the page is being
called for the first time and when data was submitted.

You can still redirect over to another page with Response.Redirect or
Server.Transfer as in "Classic ASP", but unless you really need to use the
old 2 page system, you might do well to adopt the new way.
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Top