Tim
Tim

Reputation: 1249

Closing a panel with animation using __doPostBack

I have a Custom User Control that will display messages to the user ie. Information, Error, Success. This is based off of Clickable Panel Closure I would like to add animation to the closing of the message using jquery but I am not sure how to implement this. Any suggestions? Outside of the controls being displayed my project is almost identical to the one in the link

Upvotes: 0

Views: 227

Answers (1)

Vaibhav Garg
Vaibhav Garg

Reputation: 3716

call your own JS function and do the animations inside it. Then call the __doPostBack. Make sure to postback after the animation is done.

E.g:

Javascript:

function my__doPostBack(eventTarget, eventArgument) {
    my_PanelAnimateFunction(function() { 
        __doPostBack(eventTarget, eventArgument);
    });
}

function my_PanelAnimateFunction(callback) {
    //do animation stuff
    doAnimation();

    //callback so that the __doPostBack is executed
    callback(); 
}

Codebehind:

var script = String.Format("my__doPostBack('{0}', '');", myPanel.ClientID);
myPanel.Attributes.Add(HtmlTextWriterAttribute.Onclick, script);

Upvotes: 1

Related Questions