Solved

Unable to reset ajaxToolkit CollapsiblePanel Extender state

Posted on 2009-05-06
5
475 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

739 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