ASPxCallback Class
A callback control.
Namespace: DevExpress.Web
Assembly: DevExpress.Web.v19.1.dll
Declaration
Remarks
The ASPxCallback control allows you to send callbacks from the client side and then process them both on the server and client sides.
Note
The ASPxCallback control cannot update any visual control on a web page. For this purpose, use the ASPxCallbackPanel control that serves as a container. Use the callback panel to send a callback to the server and update any control within the panel.
Create a Callback Control
Design Time
The ASPxCallback control is available on the DX.19.1: Components toolbox tab in the Microsoft Visual Studio IDE.
Drag the control onto a form and customize control settings, or paste the control markup in the page’s source code.
<dx:ASPxCallback ID="ASPxCallback1" runat="server">
</dx:ASPxCallback>
Run Time
using DevExpress.Web;
...
protected void Page_Load(object sender, EventArgs e)
{
ASPxCallback callback = new ASPxCallback();
callback.ID = "ASPxCallback2";
Page.Form.Controls.Add(callback);
callback.ClientInstanceName = "cb";
callback.Callback += new CallbackEventHandler(ASPxCallback_Callback);
}
protected void ASPxCallback_Callback(object source, CallbackEventArgs e)
{
// your code
}
Client-Side API
Availability | Available by default. |
Class name | |
Access name | |
Events |
Overview
Use the (ASPxClientCallback.PerformCallback) method to send a callback to the server. The (ASPxClientControlBase.InCallback) method allows you to get whether the callback is sent. Handle the (ASPxClientCallback.CallbackComplete) client event or the ASPxCallback.Callback server event to process the callback.
<dx:ASPxCallback ID="ASPxCallback1" runat="server" ClientInstanceName="Callback1"
OnCallback="ASPxCallback1_Callback">
<ClientSideEvents CallbackComplete="OnCallbackComplete" />
</dx:ASPxCallback>
protected void ASPxCallback1_Callback(object sender, CallbackEventArgs e) {
string xpath = string.Format("//items/item[@newsID='{0}']", e.Parameter);
XmlNode node = XmlDataSource1.GetXmlDocument().SelectSingleNode(xpath);
if(node != null)
e.Result = node.Attributes["Description"].Value;
}
function OnCallbackComplete(s, e) {
var strFeedID = e.parameter.toString();
var loadingPanel = document.getElementById("lp" + strFeedID);
var detailsContainer = document.getElementById("details" + strFeedID);
loadingPanel.style.display = "none";
detailsContainer.style.display = "";
detailsContainer.innerHTML = e.result;
}