ASPxCallback.GetRenderResult(Control) Method
Returns the HTML representation of a specific control.
Namespace: DevExpress.Web
Assembly: DevExpress.Web.v24.1.dll
NuGet Package: DevExpress.Web
Declaration
Parameters
Name | Type | Description |
---|---|---|
control | Control | A Control object that specifies the control whose HTML code should be returned. |
Returns
Type | Description |
---|---|
String | A string that contains the HTML code representing the specifid control. |
Remarks
Use the GetRenderResult method to obtain the HTML code representing a specific control. This method can be used in a handler of the ASPxCallback.Callback event to render the required web control after it’s been updated on the server side. The obtained HTML code can then be assigned to the event’s CallbackEventArgs.Result property, and sent to the client-side ASPxClientCallback.CallbackComplete event. On the client side, this code (obtained via the ASPxClientCallbackCompleteEventArgs.result parameter) can be used to replace/update the required control’s HTML representation.
Example
function ShowImage(id) {
if (ASPxCallback1.InCallback())
return;
document.getElementById('imageCell').innerHTML = 'Loading...';
ASPxCallback1.PerformCallback(id);
}
protected void ASPxCallback1_Callback(object source,
DevExpress.Web.CallbackEventArgs e) {
string xpath = string.Format("//items/item[@id='{0}']", e.Parameter);
XmlNode node = XmlDataSource2.GetXmlDocument().SelectSingleNode(xpath);
if(node != null) {
LargeImage.ImageUrl = "Images/" + node.Attributes["FileName"].Value;
LargeImage.AlternateText = node.Attributes["Text"].Value;
LargeImageText.Text = node.Attributes["Text"].Value;
}
e.Result = ASPxCallback.GetRenderResult(ImagePanel);
}
<dx:ASPxCallback ID="ASPxCallback1" runat="server" OnCallback="ASPxCallback1_Callback">
<ClientSideEvents CallbackComplete="function(s, e) {
document.getElementById('imageCell').innerHTML = e.result;
}" />
</dx:ASPxCallback>