Passing values between pages?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I've got an asp.net application with a page that collects user info via forms
and I'd like to have those values then passed to a 2nd page for a
continuation which makes use of the entered values from the previous page.
One way that I could think of would be to have the submit button's event
handler call response.redirect with a querystring attached on based on values
that I could attach on.

First question: Could I do the same thing but add the values to the post
variables (the Reqeust.form collection rather than the request.querystring
collection)? Without asp.net, I could very easiiy have the form submitted to
a new page with the client side form "action" attribute, but to be honest,
with ASP.NET, I'm not sure if/how that method would be used. Seems like a lot
of the form stuff is now handled behind the scenes and to access their
contents you just use textboxname.value for example to extract the entered
info. Can one still use the previous method where form elements are simply
submitted and then are retried via request.form or request.querystring? Can
you mix this style in a form runat=sever form? Or does this need to be in a
separate form without Runat=server ?

In any case, would this be the best method for getting the value from one
page to another? Also, what about the circumstance where the entered value is
to be masseged by this page a bit and then sent to the next page, so most
likely a direct trip from client to new page is not possible? Could one take
advantage of the fact that the two pags are in the same application? From
what I've read, it might make sense to use the current context's items
collection. Is this true? If so, is this the only option?

Thanks for any help...

-Ben
 
Ben,

The most simple is to use the page.session.items

session.item("Ben")="Had a question"

I hope this helps,

Cor
 
Hi Cor,

Thanks for your response. Do you have any idea on if this is preferable to
the current context's items collection or know if there are any more
efficient ways of doing this? Or do you have any idea about my other general
question regarding mixing modes of passing form values to pages? Thanks
again...

-Ben
 
Ben,

Although not needed can you forget with ASPNET the post and the get.

By instance a textbox returns the value that is typed in to the server when
there is a Ispostback.

You can that get it easy in your program with.

myexpectedvalue = mytextbox.text

I hope that this was your question,

Cor
 
Back
Top