sending data between two pages

U

Ugur Ekinci

Hi all,

I have two aspx pages, first one has a listbox and a button that opens popup
aspx page. Popup page has listbox control ,
so what i want to do is when I close the popup , the datas in popup's
listbox will be sent to listbox of first aspx page,
Any ideas ?

Best regards...
 
S

S. Justin Gengo

Ugar,

There are three common ways to do this:

1) Place the value to pass in the query string:
http://www.mysite.com/page2.aspx?value=[yourvaluehere]
Retrieve in page 2:
Dim ValueToRetrieve As String = Request.Querystring("value")

2) Place the value in a session variable:
In page 1:
Session.Items.Add("ValueToPass", [YourValueAsObjectHere])

In page 2:

Dim ValueToRetrieve As String =
Session.Items.Item("ValueToPass").ToString

3) Store the value in the context object and then use Server.Transfer to to
change pages.
In page 1:
Context.Items.Add("ValueToPass", [YourValueAsObjectHere])
Server.Transfer("Page2.aspx")

In page 2:
Dim ValueToRetrieve As String =
Context.Items.Item("ValueToPass").ToString

Of course you can pass any type of object in examples 2 and 3 but only
singular objects like a string or int in example 1. Also example 2 requires
a redirect be sent to the client browser in order to change pages while
example 3 does not.

In example 3 a Server.Transfer delivers page2 code to the client even though
the client thinks it's getting pag1 code. What that means is that the client
will still have page1.aspx in the addresss bar even though they will be
seeing page2.aspx. But that won't affect your code. And the client sees your
page faster because the redirect is skipped.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
 

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,776
Messages
2,569,603
Members
45,186
Latest member
vinaykumar_nevatia

Latest Threads

Top