views:

266

answers:

1

Ok so while back I asked question http://stackoverflow.com/questions/986598/beginner-asp-net-question-handling-url-link

I wanted to handle case like this www.blah.com/blah.aspx?day=12&flow=true I got my answer string r_flag = Request.QueryString["day"];

Then what I did is placed a code in Page_Load()

that basically takes these parameters and if they are not NULL, meaning that they were part of URL.

I filter results based on these parameters.

It works GREAT, happy times.... Except it does not work anymore once you try to go to the link using some other filter. I have drop down box that allows you to select filters. I have a button that once clicked should update these selections.

The problem is that Page_Load is called prior to Button_Clicked function and therefore I stay on the same page.

Any ideas how to handle this case.

Once again in case above was confusing. So I can control behavior of my website by using URL, which I parse in Page_Load() and using controls that are on the page.

If there is no query in URL it works great (controls) if there is it overrides controls. Essentially I am trying to find a way how to ignore parsing of url when requests comes from clicking Generate button on the page.

+1  A: 

Maybe you can put your querystring parsing code into IsPostBack control if Generate button is the control that only postbacks at your page.

if (!IsPostBack)
{
    string r_flag = Request.QueryString["day"];
}

As an alternative way, at client side you can set a hidden field whenever user clicks the Generate button, then you can get it's value to determine if the user clicked the Generate button and then put your logic there.

Canavar
awesome it kind causes another problem but thats the one I know how to fix. Thanks
grobartn
dude ... i wasted so much time on this ...thanks!!!
grobartn
you're welcome, I'm appreciated :)
Canavar