P
Phillip N Rounds
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 instances of this user control
on the page 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 + "_ActiveState"] = { 0, 1 } and a single session
variable
Session[ "WhichControlIsActive "] = { 'None', "ControlID_1", "ControlID2",
.... , "ControlID_N" }
When the user selects an inactive control, its Session[ this.ControlID +
"_ActiveState"] gets set to 1 and Session[ "WhichControlIsActive" ] =
this.ControlID; in the MyControl.ActivateButton_Click(..) method, and the
page gets posted back.
When the user is finished and clicks the 'Done' button, Session[
this.ControlID +"_ActiveState"] get set to 0, Session[
"WhichControlIsAcitve"] get set to 'None' in the
MyControl.ActivateButton_Click(..) method, 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?
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 instances of this user control
on the page 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 + "_ActiveState"] = { 0, 1 } and a single session
variable
Session[ "WhichControlIsActive "] = { 'None', "ControlID_1", "ControlID2",
.... , "ControlID_N" }
When the user selects an inactive control, its Session[ this.ControlID +
"_ActiveState"] gets set to 1 and Session[ "WhichControlIsActive" ] =
this.ControlID; in the MyControl.ActivateButton_Click(..) method, and the
page gets posted back.
When the user is finished and clicks the 'Done' button, Session[
this.ControlID +"_ActiveState"] get set to 0, Session[
"WhichControlIsAcitve"] get set to 'None' in the
MyControl.ActivateButton_Click(..) method, 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?