Posting values between pages

  • Thread starter Water Cooler v2
  • Start date
W

Water Cooler v2

That ASP.NET pages post to themselves, how do pages share information
amoung themselves? As in, if my index.aspx has to post data to
nextpage.aspx, how does it happen? Is it left to the developer to
persist relevant control values in a state dictionary such as Session
and read them back in the target/destination page nextpage.aspx?
 
J

Juan T. Llibre

That a page should post to itself was an ASP.NET 1.x paradigm.

In ASP.NET 2.0 you can post to other pages.




Juan T. Llibre
ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
==========================
 
S

S. Justin Gengo

The easiest way that I know of is to use a combination of storing your
value/object in the context object and utilizing Server.Transfer.

On the page being transferred from:

Dim MyValue As String = "This is my value to transfer (It could be any
object).
Context.Items.Add("MyKey", MyValue)

Server.Transfer("page2.aspx")

On page two:

Dim MyValue AS String = CType(Context.Items.Item("MyKey"), String)

(Of course Context.Items.Item("MyKey").toString would work better here, but
I used CType to illustrate that you could place any type of object into the
context object.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
 
G

Guest

Hi,
I am not familiar with th dot net framework. I want to make a SQL connection
to display the contents of a particular table in a listbox. whenever I try to
do this an error is shown up that exe file is missing.So anyone cn help me to
make a database connection and to complie the same..
Suneethi
 

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

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top