Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing variables between pages...

Status
Not open for further replies.

markgrizzle

Programmer
Aug 3, 2003
288
0
0
US
Hi,
My page_1 allows you to look up data with listbox_1. I needed to pass listbox_1.SelectedValue to page_2 so I added an id variable to the page_2 url like page_2.aspx?id = 123.Page_2 loads, sees the variable, sets listbox_2.SelectedValue to the right value, and refreshes the textbox.

But when I try to edit record data on page_2, the update procedure doesn't see the new value I entered in the textbox, and I can't click another row in listbox_2 either. It defaults back to the selected value I passed from page_1.

I think it's related to the variable in the url, since everything worked before I made the change. Can anyone point me in the right direction? I understand I can probably use session variables and/or master pages, but I'm new to this, and would ideally like a simple solution to finish this project.

Thanks in advance,
Mark
 
it looks like the page load is firing each time I try to update data on page_2, or try to use listbox_2. Sort of like an infinite loop.

So I guess my question is really, how do I pass the variable without appending it to the URL, since I need to stay on page 2 and edit data repeatedly.
 
ok, so I'm using session variables now, since I need to make multiple edits on page_2. page_1's url button click event looks like session("id") = 123.

page_2 loads and filters appropriately. Then I empty the session variable, so form edit/updates (which trigger page_load) don't have a session variable to use any more.

getting there...
 
ok, figured it out. The first time page_2 loads, I use the session variable to filter, then clear them out.

Subsequent page loads (due to data updates on the page) don't reload the original data, since the page_load event tests for the session variable before filtering.

Thanks tek-tips!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top