Maintaining Page State with Panel Control

  • Thread starter Thread starter clintonG
  • Start date Start date
C

clintonG

I'm having a problem maintaining state with a Panel control in a MasterPage
and I need help thinking through this process.
The basic structure of the HTML in the Master looks like this...

<asp:PanelActivatorLinkButton ... />
....
....
<asp:Panel Visible="[true | false]" ...>
<asp:LoadContentLinkButton ... />
<asp:ContentPlaceHolder ... />
</asp:Panel>

At design-time when the Panel's Visible property is set to true in the HTML
and the page is then loaded the Panel is displayed as expected. Thus,
selecting the PanelActivatorLinkButton is not neccessary at this point
because the Panel's Visible property has been set to true before loading the
page. Selecting the LoadContentLinkButton loads the expected content into
the ContentPlaceHolder. The "content" can be a Change Password control for
example.

The Panel should not be displayed at run-time however until the
PanelActivatorLinkButton is selected and code in its click event handler
sets the Panel's Visible property to true. The Panel will display when the
Panel Visible property is set to true using the PanelActivatorLinkButton
event.

Once the Panel has been displayed, selecting the LoadContentLinkButton then
causes the entire Panel to disappear from the page. The
LoadContentLinkButton raises a PostBack. Viewing source shows the Panel has
not generated any HTML source.

It is interesting to note that all controls appear in the control tree when
using Trace. This would include controls such as the Change Password control
that should be displayed when selecting the LoadContentLinkButton.

Now here's the good part: selecting PanelActivatorLinkButton -- again --
will raise another PostBack and the content that was supposed to be
displayed when selecting the LoadContentLinkButton the first time is
displayed and will function as expected.

There is a state issue here I haven't figured out yet. Your comments?
 
Resolved.

// Defined a property in the Master for the Panel control
public Panel MembershipControlPanelProperty
{
get { return MembershipControlPanel; }
set { MembershipControlPanel = value; }
}

// Access the property in the content page being called by
LoadContentLinkButton
Master.MembershipControlPanelProperty.Visible = true;

<%= Clinton Gallagher
NET csgallagher AT metromilwaukee.com
URL http://www.metromilwaukee.com/clintongallagher/
 
Back
Top