Solved

Unable to reset ajaxToolkit CollapsiblePanel Extender state

Posted on 2009-05-06
5
472 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

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!
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

803 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