Back to Devexpress

How to: Display Real-Time Data

aspnet-114326-components-card-view-examples-how-to-display-real-time-data.md

latest1.2 KB
Original Source

How to: Display Real-Time Data

  • Dec 17, 2020

The only way to display dynamic data is to update the grid’s data source at regular intervals. To do this, you can use the ASPxTimer component. Specify the required time interval via the ASPxTimer.Interval property, and handle the client-side ASPxClientTimer.Tick event to call the grid’s ASPxClientCardView.PerformCallback method.

javascript
<dxt:ASPxTimer ID="ASPxTimer1" runat="server" Interval="5000">
    <ClientSideEvents Tick="function(s, e) {
        cardview.PerformCallback();
    }" />
</dxt:ASPxTimer>

This method sends a callback to the server and generates the server-side ASPxCardView.CustomCallback event. Handle this event to update the grid’s data source.

csharp
protected void ASPxCardView1_CustomCallback(object sender,
    DevExpress.Web.ASPxCardViewCustomCallbackEventArgs e) {
    ASPxCardView1.DataBind();
}