Callback or Post back in DevExpress Web Controls:
Standard ASP.NET controls don't use callbacks, and all their internal processing is performed via postbacks only. This approach is good when a page content is simple, so a browser can download the light page and render it quickly. However, when web sites contain many heavy-weight controls, this approach isn't suitable, because it might reduce page performance.
What happens at Ajax UpdatePanel Asynchronous postback:When the Microsoft Atlas (ASP.NET AJAX) framework was introduced, a new UpdatePanel control was provided. This control intercepts postbacks that occur within a page, and converts them to asynchronous postbacks. During an asynchronous postback, the AJAX only renders a panel that initiated the postback, for example, if you have three asp:UpdatePanel controls, and one of them causes the postback, only this panel will be rendered.
Is Callbacks and asynchronous postbacks are same:
Callbacks differ from asynchronous postbacks even if they provide almost the same results (in case of callbacks, only part of a page is refreshed).
Callback Page Life Cycle:
The callback result always contains a part of a page (HTML tags, scripts, styles, etc.), the part that was updated. As compared with the AJAX behavior, the callback result is very similar to what the asp:UpdatePanel returns from the server when an asynchronous postback is processed. As the page life cycle during callbacks is shorter than during postbacks, you should always remember that the ViewState isn't updated on callbacks, as well as the PreRender event isn't raised on callbacks, too.
These two points aren’t usually taken into account when a user moves from asp:UpdatePanel controls to the ASPxCallbackPanel ones.
Most of "large" DevExpress ASP.NET controls, such as ASPxGridView, ASPxTreeList, ASPxPivotGrid, use their own callbacks (since the EnableCallBacks property equals "true") to update their own rendering during a round-trip to the server, which is intended to change a corresponding control's state.
It is, however, possible to disable the controls' callbacks by setting the EnableCallBacks property to "false", to force the controls to work in the standard postback mode (in the same manner as the standard controls work), and put the controls, for example, into the UpdatePanel, (as it is illustrated in the ASP.NET AJAX - Update Panel Online Demo), so that the controls can work with MS AJAX / ControlTookit together.
During a partial update, the result obtained from the server contains HTML page markup, which will be placed in the updated area. For example, you have an ASPxButton, a label within the asp:UpdatePanel and a label outside the asp:UpdatePanel. On the button's click event, you want to update both labels. What will be the result? On the server side, two labels will be updated. However, as it is stated above, the result obtained from the server will have the ASPxButton and the first label. So, after a postback, you'll get the updated first label only.
During a partial update, the result obtained from the server contains HTML page markup, which will be placed in the updated area. For example, you have an ASPxButton, a label within the asp:UpdatePanel and a label outside the asp:UpdatePanel. On the button's click event, you want to update both labels. What will be the result? On the server side, two labels will be updated. However, as it is stated above, the result obtained from the server will have the ASPxButton and the first label. So, after a postback, you'll get the updated first label only.
This statement can be easily applied to the ASPxCallbackPanel: assume you have both the ASPxButton and a label outside the ASPxCallbackPanel, and a single label within the callback panel. The button has the ASPxButton.AutoPostBack property disabled, and the callback panel is refreshed using the ASPxClientCallbackPanel.PerformCallback method:
[JScript]
function OnClick (s, e) {
callbackPanel.PerformCallback ();
}
callbackPanel.PerformCallback ();
}
On the server side, both labels will be updated using the following ASPxCallbackPanel.Callback event handler:
[C#]
protected void callbackPanel_Callback(object source, CallbackEventArgsBase e) {
lblInside.Text = "Inside";
lblOutside.Text = "Outside";
}
lblInside.Text = "Inside";
lblOutside.Text = "Outside";
}
According to the declared statement, the content within the ASPxCallbackPanel will be updated. After a callback, you'll see the inner label updated, not the outer one.
No comments :
Post a Comment