Panel visibilty on/off toggle effect not working
<p>I've a got ListBox called lbxUpcommingEvents. When the index is changed the event handler is fired to check for duplicate records. If duplicates are not found, a panel called pnlAction inside a formview is turned on by the way of display style. If dups are found another panel pnlActionCancel is turned on and the oter is tuned off. Basically a toogle effect. </p>

<p>I've tried the visible property, viewstate property, but it does not work and I can't figure it out so once again, I seek wizdom from the collective. Here is my code.</p>

<pre><code>protected void lbxUpcommingEvents_OnSelectedIndexChanged(object sender, EventArgs e)
{
    pnlEventsSignUp.Visible = true;
    string _selectedItemValue = lbxUpcommingEvents.SelectedValue.ToString();
    int _eventid = Convert.ToInt32(_selectedItemValue);

    Guid _memberId = Guid.Empty;
    _memberId = new Guid(Session["myId"].ToString());

    // Check for existing signup
    EventsMemberSignup _createSingup = new EventsMemberSignup();
    dsEventsSingupTableAdapters.MemberEventsTableAdapter da = new dsEventsSingupTableAdapters.MemberEventsTableAdapter();
    dsEventsSingup.MemberEventsDataTable dt = da.GetDataForDupCheck(_memberId, _eventid);

    if (dt.Rows.Count == 1)
    {
        Panel pnlAction = (Panel)(fvEventSignUp.FindControl("pnlAction"));
        //pnlAction.Visible = false;
        pnlAction.Style.Add("display","none");

        Panel pnlActionCancel = (Panel)(fvEventSignUp.FindControl("pnlActionCancel"));
        //pnlActionCancel.Visible = true;
        pnlActionCancel.Style.Remove("display");
    }
    else
    {
        Panel pnlActionCancel = (Panel)(fvEventSignUp.FindControl("pnlActionCancel"));
        //pnlActionCancel.Visible = false;
        pnlActionCancel.Style.Add("display", "none");

        Panel pnlAction = (Panel)(fvEventSignUp.FindControl("pnlAction"));
        //pnlAction.Visible = true;
        pnlAction.Style.Remove("display");
    } 
}

&lt;div id="columnleft"&gt;
&lt;a name="content_start" id="content_start"&gt;&lt;/a&gt;
&lt;div class="leftblock"&gt;
    &lt;h2&gt;Events Signup&lt;/h2&gt;
    &lt;p&gt;               
    &lt;/p&gt;
    &lt;h3&gt; Upcomming Events&lt;/h3&gt;
    &lt;p&gt;
        &lt;asp:ListBox ID="lbxUpcommingEvents" runat="server" DataSourceID="odsUpcommingEvents" 
            Rows="6" DataTextField="Title" DataValueField="id" AutoPostBack="true"
            Width="206px" OnSelectedIndexChanged="lbxUpcommingEvents_OnSelectedIndexChanged"  /&gt;
    &lt;/p&gt;
    &lt;h3&gt; Members Attending&lt;/h3&gt;
    &lt;p&gt;
        &lt;asp:DataGrid ID="lboxSignedUpMembers" runat="server" DataSourceID="odsSignedUpMembers" 
            AutoPostBack="true" AutoGenerateColumns="false" RowStyle-CssClass="gridview" AlternatingRowStyle-CssClass="altbgcolor"
            Width="206px" onselectedindexchanged="lboxSignedUpMembers_SelectedIndexChanged" CssClass="gridview"
            GridLines="None"  BorderStyle="Solid" BorderWidth="1" BorderColor="Black" &gt;
            &lt;AlternatingItemStyle BackColor="White" /&gt;
            &lt;Columns&gt;
                &lt;asp:BoundColumn DataField="Name" /&gt;
                &lt;asp:BoundColumn DataField="Title" /&gt;
                &lt;asp:TemplateColumn &gt;
                    &lt;ItemTemplate&gt;
                        &lt;asp:Label runat="server" ID="lblDate" Text='&lt;%# Eval("StartTime", "{0:d}") %&gt;' /&gt;
                    &lt;/ItemTemplate&gt;
                &lt;/asp:TemplateColumn&gt;
            &lt;/Columns&gt; 
        &lt;/asp:DataGrid&gt;
    &lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/td&gt;
&lt;td align="left" &gt;
&lt;!--Start of right column--&gt;
&lt;div id="columnright"&gt;
&lt;div class="rightblock"&gt;
    &lt;asp:Panel ID="pnlEventsSignUpTitle" runat="server" CssClass="actionbuttons"&gt;
        &lt;h2&gt;Select an Event to Signup&lt;/h2&gt;
    &lt;/asp:Panel&gt;
    &lt;asp:Label runat="server" ID="lblNote" ForeColor="#cc0000" Font-Bold="true" /&gt;
&lt;/div&gt;
&lt;div class="rightblock"&gt;
    &lt;asp:Panel runat="server" ID="pnlEventsSignUp" visible="false"&gt;           

        &lt;div class="dashedline" &gt;&lt;/div&gt;
        &lt;asp:FormView ID="fvEventSignUp" runat="server" DataSourceID="ObjectDataSource1" 
            DataKeyNames="id" Width="100%" &gt;
            &lt;ItemTemplate&gt;
                &lt;h2&gt;
                    &lt;asp:HiddenField runat="server" ID="hfEventID" Value='&lt;%# Eval("id") %&gt;' /&gt;
                    &lt;asp:Label Text='&lt;%# Eval("title") %&gt;' runat="server" ID="titleLabel" /&gt;
                &lt;/h2&gt;
                &lt;div class="itemdetails"&gt;
                    &lt;br /&gt;
                    location:
                    &lt;h3&gt;
                        &lt;asp:Label ID="locationLabel" runat="server" Text='&lt;%# ShowLocationLink(Eval("locationname"),Eval("location")) %&gt;' /&gt;
                    &lt;/h3&gt;
                    &lt;p&gt;
                        &lt;asp:Label Text='&lt;%# Eval("starttime","{0:D}") %&gt;' runat="server" ID="itemdateLabel" CssClass="GeneralText" /&gt;

                        &lt;asp:Label Text='&lt;%# ShowDuration(Eval("starttime"),Eval("endtime")) %&gt;' runat="server" ID="Label1"  CssClass="GeneralText" /&gt;
                    &lt;/p&gt;
                &lt;/div&gt;
                &lt;div class="downloadevent"&gt;
                    &lt;a href="#"&gt;
                        &lt;img src="images/icon_download_event.gif" alt="Download this event to your personal calendar"
                            width="15" height="26" /&gt;&lt;/a&gt;&lt;a href='&lt;%# "events_download.ashx?EventID=" + Convert.ToString(Eval("id")) %&gt;'&gt;Add
                                this event to your personal calendar&lt;/a&gt;
                &lt;/div&gt;
                &lt;Club:ImageThumbnail ID="thumb1" runat="server" ImageSize="Large" PhotoID='&lt;%# Eval("photo") %&gt;' /&gt;
                &lt;p&gt;
                    &lt;asp:Label Text='&lt;%# Eval("description") %&gt;' runat="server" ID="descriptionLabel" /&gt;
                &lt;/p&gt;
                &lt;div class="dashedline" &gt;&lt;/div&gt;
                &lt;asp:Panel ID="pnlAction" runat="server" CssClass="actionbuttons" &gt;
                    &lt;table border="0" cellpadding="2" cellspacing="2"&gt;
                        &lt;tr&gt;
                            &lt;td&gt;
                                &lt;asp:Label runat="server" ID="Label2" Text="Action&lt;br /&gt;Required" Width="80px" Font-Bold="true"
                                            ForeColor="#cc0000" Font-Size="14px" /&gt;
                            &lt;/td&gt;
                            &lt;td&gt;
                                &lt;img src="images/RedArrow.jpg" alt="Red Arrow Right" /&gt;
                            &lt;/td&gt;
                            &lt;td&gt;
                                &lt;asp:CheckBox runat="server" ID="cbxCert" Height="30px" Text="Check to Confirm Attendance" /&gt;&lt;br /&gt;
                                &lt;asp:CustomValidator runat="server" ID="rfvConfirm" 
                                            ErrorMessage="You must check the box to continue" Font-Bold="true"
                                            ForeColor="#cc0000" ClientValidationFunction="ensureChecked" /&gt; &lt;br /&gt;
                                &lt;Club:RolloverLink ID="rlnkSignUp" runat="server" Text = "I will be attending this event" 
                                        OnClick="rlnkSignUp_OnClick" ToolTip="I hereby certify that I am commiting to attending this event."
                                /&gt;
                            &lt;/td&gt;
                        &lt;/tr&gt;
                    &lt;/table&gt;                                            
                &lt;/asp:Panel&gt;
                &lt;asp:Panel runat="server" ID="pnlActionCancel" CssClass="actionbuttons" &gt;
                    &lt;table border="0" cellpadding="2" cellspacing="2"&gt;
                        &lt;tr&gt;
                            &lt;td&gt;
                                &lt;asp:Label runat="server" ID="lblDupSignup" Text="You are alredy signed up for this event" ForeColor="#cc0000" Font-Bold="true" Font-Size="14px" /&gt;
                            &lt;/td&gt;
                            &lt;td&gt;

                            &lt;/td&gt;
                            &lt;td&gt;
                                &lt;asp:CheckBox runat="server" ID="cbxCancel" Height="30px" Text="Check to Cancel Attendance" /&gt;&lt;br /&gt;
                                &lt;asp:CustomValidator runat="server" ID="CustomValidator1" 
                                            ErrorMessage="You must check the box to continue" Font-Bold="true"
                                            ForeColor="#cc0000" ClientValidationFunction="ensureChecked" /&gt; &lt;br /&gt;
                                &lt;Club:RolloverLink ID="rlnCancel" runat="server" Text="I'm cancelling my participation"
                                        OnClick="rlnCancel_OnClick" /&gt;
                            &lt;/td&gt;
                        &lt;/tr&gt;
                    &lt;/table&gt;                                            
                &lt;/asp:Panel&gt;
            &lt;/ItemTemplate&gt;
        &lt;/asp:FormView&gt;
    &lt;/asp:Panel&gt;
&lt;/div&gt;
</code></pre>

<p></p>
