Skip to content

DevExpress-Examples/asp-net-web-forms-update-an-external-control-on-a-callback

Repository files navigation

GridView for Web Forms - How to update an external control during a callback

A control can update only its own rendering in a callback. This example shows how to update the ASPxLabel control when a callback of the ASPxGridView control is finished.

Label updated on grid callback

ASPxGridView sends callbacks to update row data on the server. The control raises the EndCallback client event after a callback is successfully executed. You can handle the event to perform custom actions with another control when the callback is finished.

<dx:ASPxGridView ...>
    <ClientSideEvents EndCallback="OnEndCallBack" />
</dx:ASPxGridView>

ASPxGridView implements the JSProperties property that allows you to pass information from the server to the client. In this example, an updated row’s key is saved to the JSProperties property on the server. This value is then used on the client to display information about the updated row.

protected void Page_Load(object sender, EventArgs e) {
    ASPxGridView1.JSProperties["cpIsUpdated"] = "";
}
protected void ASPxGridView1_RowUpdated(object sender, DevExpress.Web.Data.ASPxDataUpdatedEventArgs e) {
    if (e.Exception == null) {
        ((ASPxGridView)sender).JSProperties["cpIsUpdated"] = e.Keys[0];
    }
}
function OnEndCallBack(s, e) {
    if (s.cpIsUpdated != '') {
        clientLabel.SetText('Category ' + s.cpIsUpdated + ' is updated successfully');
    }
    else {
        clientLabel.SetText('');
    }
}

Files to Look At

Documentation

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)

About

Update the ASPxLabel control when a callback of the ASPxGridView control is finished.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 5