IWETHEY v. 0.3.0 | TODO
1,095 registered users | 0 active users | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New Re: handling a recursive ASP.Net web page
Page_load will happen every time the page is loaded. So what you want to do is have ResearchButton_Click setup the values and then call SearchResults.aspx as if it was being called from StartSearch.aspx again.

Jay
New That's what I wanted
It took some time to get over the mental hump of having a page call itself.

Back in the old VB6 world having a subroutine call the Form_Load event was no big deal; however, in the web world calling the Page_Load IS a big deal (you need to provide the two parameters that the system automatically fills in for you). I had to reset a bunch of variables, then reload them into Session variables, and then finally have the code do a "Response.Redirect("page") to call itself from scratch.

Thanks everyone!

"Chicago to my mind was the only place to be. ... I above all liked the city because it was filled with people all a-bustle, and the clatter of hooves and carriages, and with delivery wagons and drays and peddlers and the boom and clank of freight trains. And when those black clouds came sailing in from the west, pouring thunderstorms upon us so that you couldn't hear the cries or curses of humankind, I liked that best of all. Chicago could stand up to the worst God had to offer. I understood why it was built--a place for trade, of course, with railroads and ships and so on, but mostly to give all of us a magnitude of defiance that is not provided by one house on the plains. And the plains is where those storms come from."

-- E.L. Doctorow
New I don't get it (well, I do but,,,)
ASP.Net is designed around the idea of pages posting back to themselves. You actually have to go out of your way to do otherwise.

The difficulty in your situation is if you want to modify those search parameters in the QueryString for each new search. ASP.Net wants to treat a URL with a different QueryString like a new request for the page instead of a postback to the same one (in which case it would preserve and rebuild the state of the page and the event to call server-side in hidden VIEWSTATE form variables), so it doesn't let you just modify the QueryString and postback. You have to instead go through the trouble of rebuilding the QueryString yourself and calling Response.Redirect().
New Yep, it's a hack
I'm sure there is a more ASP.NET style solution that involves reworking the connection object and moving the data pull into it's own subroutine that can be called from both the Page_load and button click event.

Honestly though, even when I was coding ASP.NET, I went out of my way to minimize the use of it's event cycle. It's just adding a layer of obscurement to the web event cycle and exists only to try and make ASP.NET and windows forms have a similar event loop. Which doesn't archive anything, good form coding and good web coding still remain vastly different, because the bottlenecks are in different places and the platform fundamentally different.

Jay
New Re: Yep, it's a hack
I do think there's a misunderstanding by Lincoln of the magic ASP.net is doing behind the scenes here. It's understandable given his desktop VB background. I came at ASP.Net after doing plain old HTML form processing with Perl and CGI, so I knew there had to be something keeping state for me and rebuilding object trees server side and routing "events" via hidden form variables.

But it's definitely geared towards "application" style design rather than "website" design.

PS: The ASP.Net style design would have been to ditch the StartSearch.aspx page and just have a single Search.aspx page that only enables the results grid and does the DB work if there is content in the search textbox.
Expand Edited by altmann March 13, 2009, 01:08:02 AM EDT
     handling a recursive ASP.Net web page - (lincoln) - (10)
         sudo apt-get install php __________ :-P -NT - (drook) - (1)
             Not unless you plan - (lincoln)
         Some random ideas. - (Another Scott)
         Re: handling a recursive ASP.Net web page - (altmann)
         can you reuse the module for the original search? - (boxley)
         Re: handling a recursive ASP.Net web page - (jay) - (4)
             That's what I wanted - (lincoln) - (3)
                 I don't get it (well, I do but,,,) - (altmann) - (2)
                     Yep, it's a hack - (jay) - (1)
                         Re: Yep, it's a hack - (altmann)

I'm not quite dead yet...
73 ms