Updated one updated update panel and another?

I have a script, I have two update panels on the page (both have update mode = "conditional"). If I update one update panel, it automatically updates. This is the first problem.

I am using UpdatePanelAnimationExtender . If one update panel is updated, which does not have an updated version of updateAlimationExtender, which is also updated and has updatepanelAnimationExtender, OnUpdatingUpdatePanel (); the event is fired. As the documentation of updatepanelAnimationExtender says: http://www.asp.net/AJAX/AjaxControlToolkit/Samples/UpdatePanelAnimation/UpdatePanelAnimation.aspx

OnUpdating . General animation plays as when anyone UpdatePanelstarts updating

OnUpdated . General animation played after the update is completed UpdatePanel(but only when modified UpdatePanel)

Problem: OnUpdating running, and it runs the backend and is not completed, because it onUpdatedonly starts when UpdatePanelChanged

+3
source share
2 answers

" 2 , updatemode = '' 1, Asyn 1 .... , , , , "

, 2'nd ? , , . , ?

+1

. , UpdateMode = "". , , . UpdatePanelAnimationExtender, UpdatePanel A, UpdatePanel B, , UpdatePanel A OnUpdating, OnUpdated ( ).

: , . , script. . .

// Variable to hold ScriptManager.  Just slap this in the class for the page.
private ScriptManager scriptManager;

// Get the ScriptManager.  Put this in Page_Init handler.
// If you have the ScriptManager on the same page, just refer to it directly.
// If you have it on the master page, you can get a reference to it like so.
// The second line shows one way you can get a reference to the ScriptManager from
// a user control.
// FYI, the same code applies to a ToolkitScriptManager.
scriptManager = ScriptManager.GetCurrent(this);
// scriptManager = ScriptManager.GetCurrent(HttpContext.Current.Handler as Page);

// This function checks whether an UpdatePanel is being updated
private Boolean IsUpdatePanelUpdating(String sUPID)
{
    String sUpdateValue = Request.Form[Request.Form.AllKeys.Where(s => s.EndsWith(scriptManager.ClientID)).FirstOrDefault()] ?? String.Empty;
    return sUpdateValue.Contains(sUPID);
}

// This is code you can put somewhere (say within OnLoad handler) to make an
// UpdatePanel A get updated even if an unrelated UpdatePanel B is currently being
// updated.
if (!IsUpdatePanelUpdating(upA.ClientID))
    upA.Update(); 

, -.

0

Source: https://habr.com/ru/post/1713447/


All Articles