Sorry, my post wasn't specific enough. I was trying to shorten a previous 2
page post and got overly terse.
I'm writing a user control which has two states: Active & InActive. I
additionally am required that there to be only one active control per page,
and all logic has to be contained within the control.
In its inactive state, only a single button appears. If the user clicks on
this button, the control becomes active( the rest of the control's
functionality becomes visible), and all other controls should become
inactive. When the user is finished with a control, they click the 'Done'
button, and the control becomes inactive.
I'm trying to do this by having a session variable for each control,
Session[ this.ControlID + "_ActiveSta te"] = { 0, 1 } and a single session
variable
Session[ "WhichControlIs Active "] = { 'None', "ControlID_ 1", "ControlID2 ",
.... , "ControlID_ N" }
When the user selects an inactive control, its Session[ this.ControlID +
"_ActiveSta te"] gets set to 1 in the Control.Activat eButton_Click(. .)
method, and Session[ "WhichControlIs Active" ] = this.ControlID; , and the
page gets posted back.
When the user is finished and clicks the 'Done' button, Session[
this.ControlID +"_ActiveSta te"] get set to 0, Session[
"WhichControlIs Acitve"] get set to 'None', and the page gets posted back.
I now want the new page to reflect the new session variables. My problem is
that the new session variables don't get saved until after the Page_Load
event of the new page, so these session variables are useless in structuring
the subsequent pages.
I can't use hidden fields, because they would have to be in a public place
( i.e. the containing page ), and I'm required to have all logic internal.
Similarly,
the Request.Form["_ "] isn't available to the controls.
Is there really no good way to do this?
"Eliyahu Goldin" <re************ *@monarchmed.co m> wrote in message
news:ux******** ******@TK2MSFTN GP14.phx.gbl...
This is correct.
You can't do anything BEFORE the postback, since it is the postback that
cause your application to run. You probably mean "in the beginning" of the
postback handling code. Just put it in the beginning of Page_Load event,
if you can. If you need to know what caused the postback, you can check
Request.Form["__EVENTTAR GET"] (works in most cases, but there are
exceptions), or pass it in your own hidden input.
Eliyahu
"Phillip N Rounds" <pr*****@cassan dragroup.com> wrote in message
news:OB******** ******@TK2MSFTN GP11.phx.gbl... In diagnosing a problem, I noted that a button_click event gets run only
after the page Page_Load event of the post back. (VS 2003, ASPNET 1.1,
C#)
Can this be correct? I'm trying to set session variables in a
Button_Click event which determines how the page is supposed to appear in
the PostBack, so of course it fails.
Where should I put my code so that the session variables are re-set
before the PostBack?
Thanks
Phil