Solved

Unable to reset ajaxToolkit CollapsiblePanel Extender state

Posted on 2009-05-06
5
469 Views
Last Modified: 2012-06-27
Hi Experts,

after answering questions here for quite a while now i finally ran into a problem i cannot seem to solve myself so here's my first EE question.

Following Scenario:

Two panels, one visible, one unvisible. The visible panel has a button "Add" which hides the visible panel and unhides the unvisible panel with an input form.

Inside of this panel there's an AJAX Toolkit CollapsiblePanel extender. Both the CollapseControlID and ExpandControlID properties are set to a Checkbox outside of the panel that gets collapsed and expanded. The Checkbox is checked by default. The Panel is collapsed by default and AutoCollapse is set to false. If the Checkbox gets unchecked the Panel expands and displays some textboxes. If the Checkbox gets checked again the panel collapses. This works just as expected.
 
Below the collapsiblepanel there's a cancel button which resets all input controls to their default state and hides the form panel and shows the original panel again with the "Add" button.

If i now click "Cancel" with the panel in expanded state and click "Add" again all controls are in its original state except for the CallibsiblePanel which is expanded even though the CheckBox which controls it is Checked. This makes my form go totally out of sync as unchecking the checkbox now collapses the panel.

I tried multiple things to have the CollapsblePanel be reset to its original collapsed state:

In the OnClick event of the cancel button as advised by posts found on the msdn forums (also tried this in the Page_Load as a test to no avail):
_myCollapsiblePanelExtender.Collapsed = true;
_myCollapsiblePanelExtender.ClientState = "true";

I also tried adding a OnClientClick event to the Cancel button and collapse the panel on client side via javascript (The extender had its BevhaviorID set to "csvPosPanel":
function ClosePosPanel() { $find("csvPosPanel").collapsePanel(); }

Nothing worked so far. If anything is unclear feel free to ask for clarification.

Any educated advice is greatly appreciated. Thanks!
0
Comment
Question by:tillgeffken
  • 3
  • 2
5 Comments
 
LVL 2

Accepted Solution

by:
yaantbarb earned 500 total points
ID: 24316357
Hi there,

I haven't found a definitive reason for this behaviour but i've found that by setting the collapse panel extenders EnableViewState property to "false" it seems to fix it.

I'm still looking for an actual reason for the behavior but hopefully this will help you for now.
0
 
LVL 9

Author Comment

by:tillgeffken
ID: 24316629
Hey vaantbarb,

that indeed fixes the symptoms. I have tested one million things but that i didn't try. From what i have tested so far it does not break other parts of my web form either so i might end up using this workaround.

However i'm still wondering why this could be happening. Also what if i ever need the extender to be in ViewState?

I'll leave this question open for a little longer - maybe you or someone else comes up with an explanation.

Thanks alot so far!


0
 
LVL 2

Assisted Solution

by:yaantbarb
yaantbarb earned 500 total points
ID: 24316844
Hi again,

I've still not found an explanation for the bug but another workaround would be to set the collapse panel extenders Collapsed and ClientState properties to True and "true" in the Click event for the Add button.
0
 
LVL 9

Author Comment

by:tillgeffken
ID: 24373490
I posted this issue on the ASP.NET forums aswell but it seems that this is either considered expected behavior or noone knows a Solution/Explanation - the thread got 0 replies. Closing the question, awarding points to vaantharb for a work-around.
0
 
LVL 9

Author Closing Comment

by:tillgeffken
ID: 31578395
Thanks mate. Accepting both as solution as one might need, or not need, viewstate on the control.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
OverviewThis article demonstrates a simple search form using AJAX. The purpose of the article is to demonstrate how to use the same code to render a page and javascript (JQuery) and AJAX to make subsequent calls to refine the results. The princip…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now