form issues

  • Thread starter Thread starter Dan
  • Start date Start date
D

Dan

I don't get it.

on page1.aspx I have set the <form action="page2.aspx"
runat="server">

but the page keeps referring back to itself...why
won't it call the second page?
 
Setting the form action attribute just isn't the ASP.NET way.

Of course there are a number of ways to pass values from one page to
another, such as using the querystring, cookies, session,
context, saving to a temporary table in the database between each page, etc.
You'll have to decide which technique is best for your application.
Here are several good articles on the subject to help you decide.
http://msdn.microsoft.com/msdnmag/issues/03/04/ASPNETUserState/default.aspx

http://www.aspalliance.com/kenc/passval.aspx

http://www.dotnetjunkies.com/tutorials.aspx?tutorialid=600

http://www.dotnetbips.com/displayarticle.aspx?id=79

Here's one nice, simple way to pass values from one page to another:

'Add data to the context object before transferring
Context.Items("myParameter") = x
Server.Transfer("WebForm2.aspx")

Then, in WebForm2.aspx:

'Grab data from the context property
Dim x as Integer = CType(Context.Items("myParameter"),Integer)
 
Because Microsoft thought that all pages should be both view and model in
Asp.Net (i.e. all pages should both create the view of the data and process
the logic, both before the data is entered and after). Just don't use server
side forms, that way you can have as many as you want in a page and they can
post to pages that will do the processing (and transfer/redirect back to the
input page if needed). You'll be lot better off.

Jerry
 
Back
Top