[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Unable to reset ajaxToolkit CollapsiblePanel Extender state

Posted on 2009-05-06
5
Medium Priority
?
479 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 2000 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 2000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

656 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