whykeepderegingme
Programmer
Hey,
I want to run a button click event BEFORE postback. Logical, yes. Useful, yes, on pretty much every page of my web app.
It makes perfect sense to me, my logic does:
You have a page with 2 panels on it. The first, "Language" has a few buttons on it, for language selection. The second, "Login" has login textboxes.
Initially, "Language" is visible. So you click a language button. That button fires an event, which sets language cookie, and sets "Login" panel to visible and "Language" panel to hidden.
Then, postback occurs. Lets say Page_Load checks if cookie exists to change panels, because I don't trust that you can change panels in button event. The cookie exists, so the "Login" panel is made visible. All is well with the world.
Alas, reality is nothing like my logical fantasy, here is what is happening:
You click the button. Immediately, postback occurs, says "hey, there is no cookie", so display the same page again. Then click event occurs, and creates the cookie.
So I have to click said button AGAIN, and only then does postback say "oh, there is a cookie".
Seriously, am I missing something here?
I want to run a button click event BEFORE postback. Logical, yes. Useful, yes, on pretty much every page of my web app.
It makes perfect sense to me, my logic does:
You have a page with 2 panels on it. The first, "Language" has a few buttons on it, for language selection. The second, "Login" has login textboxes.
Initially, "Language" is visible. So you click a language button. That button fires an event, which sets language cookie, and sets "Login" panel to visible and "Language" panel to hidden.
Then, postback occurs. Lets say Page_Load checks if cookie exists to change panels, because I don't trust that you can change panels in button event. The cookie exists, so the "Login" panel is made visible. All is well with the world.
Alas, reality is nothing like my logical fantasy, here is what is happening:
You click the button. Immediately, postback occurs, says "hey, there is no cookie", so display the same page again. Then click event occurs, and creates the cookie.
So I have to click said button AGAIN, and only then does postback say "oh, there is a cookie".
Seriously, am I missing something here?