Back to Devexpress

DataSourceFillErrorEventArgs Class

corelibraries-devexpress-dot-dataaccess-f43dbb22.md

latest3.8 KB
Original Source

DataSourceFillErrorEventArgs Class

Provides data for the FillError event.

Namespace : DevExpress.DataAccess

Assembly : DevExpress.DataAccess.v25.2.dll

NuGet Package : DevExpress.DataAccess

Declaration

csharp
public class DataSourceFillErrorEventArgs :
    EventArgs
vb
Public Class DataSourceFillErrorEventArgs
    Inherits EventArgs

DataSourceFillErrorEventArgs is the data class for the following events:

Remarks

A DataSourceFillErrorEventArgs class instance stores the details of the exception that occurs if the Fill() method fails to populate the JsonDataSource with data. Handle the FillError event to access the DataSourceFillErrorEventArgs members.

Use the ConnectionName property to get the name of the connection that was used when the FillError event occurred.

The Exception property stores one of the following exceptions:

  • WebExceptions, if the endpoint’s Uri is not accessible.
  • IOExceptions, if JSON data cannot be loaded from the file system.
  • JSON data parse errors, if the JSON data structure is incorrect.

Enable the Handled property to specify that the event has been handled.

Example

The code sample below creates a new data source, handles the FillError event to to process exceptions, and tries to populate the data source with data.

csharp
using DevExpress.DataAccess;
using DevExpress.DataAccess.Json;
// ...
// Create a new JSON source.
var jsonSource = new UriJsonSource() {
    Uri = new Uri(@"https://invalid.json")
};
// Assign the JSON source to the data source.
var datasource = new JsonDataSource() {
    JsonSource = jsonSource
};
datasource.FillError += (s, e) => {
    e.Handled = true;
    // Add code that handles the data source fill error here.
};
vb
Imports DevExpress.DataAccess
Imports DevExpress.DataAccess.Json
' ...
' Create a new JSON source.
Dim jsonSource = New UriJsonSource() With {.Uri = New Uri("https://invalid.json")}
' Assign the JSON source to the data source.
Dim datasource = New JsonDataSource() With {.JsonSource = jsonSource}
AddHandler datasource.FillError, Sub(s, e)
                                     e.Handled = True
                                     ' Add code that handles the data source fill error here.
                                 End Sub

Inheritance

Object EventArgs DataSourceFillErrorEventArgs

See Also

DataSourceFillErrorEventArgs Members

DevExpress.DataAccess Namespace