views:

234

answers:

1

I am trying to update and updatepanel from javascript.

The code I'm using works, but only seems to do a full page post back.

function RefreshAppearances() {
    var prm = Sys.WebForms.PageRequestManager.getInstance();
    prm._doPostBack('<%=Me.updAppearances.ID %>', '');
}

When the updatepanels load event fires the ScriptManager.IsInAsyncPostBack always returns false.

Why might this be happening?

A: 

I don't this method is supposed to be used directly. The idea I think is to use the standard doPostBack function:

__doPostBack(eventTarget, eventArgument) {
    if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
        theForm.__EVENTTARGET.value = eventTarget;
        theForm.__EVENTARGUMENT.value = eventArgument;
        theForm.submit();
    }
}

or use the Page.ClientScript.GetPostBackClientHyperLink method to form a method call for you. If AJAX is available and partial post backs are enabled, the post back call should be intercepted by the ScriptManager and the update panel should be updated properly.

Nate

related questions