Class DataItem
Inherited Members
Namespace: Telerik.Reporting
Assembly: Telerik.Reporting.dll
Syntax
public abstract class DataItem : ReportItem, IReportItem, IComponent, IDisposable, IToggleVisibilityTarget, IActionTarget, IDesignTimeStyleEditable, IDesignTimeSelectable, IDataItem, IDataFlow, INamedObject, ISupportsNeedDataSource
Constructors
DataItem()
Declaration
public DataItem()
Properties
DataSource
Gets or sets the data source that the Table is displaying data for.
Declaration
public object DataSource { get; set; }
Property Value
System.Object
An object that functions as a data source. |
Implements
Remarks
The following data sources are valid:
- A System.Data.DataTable
- A System.Data.DataView
- A System.Data.DataSet
- A System.Data.DataViewManager
- Any component that implements the System.ComponentModel.IListSource interface
- Any component that implements the System.Collections.IEnumerable interface
- Any component that implements the System.Data.IDataAdapter interface
If the DataSource reference contains more than one table,
you must set the DataMember property a string that specifies
the table to bind to. For example, if the DataSource is a
DataSet or DataViewManager that contains three tables
named Customers
, Orders
, and
OrderDetails
, you must specify the table to bind to.
Setting the DataSource to an object that does not implement the IListSource, IEnumerable, or IDataAdapter will cause an exception.
Filters
Gets a FilterCollection that defines the filter expression(s) for the Table
Declaration
public FilterCollection Filters { get; }
Property Value
FilterCollection
FilterCollection that contains the Filter objects for the Table |
Remarks
Filter expressions limit the data that is displayed to the user after the data is retrieved from the data source.
NoDataMessage
Gets or sets the current data item no data message.
Declaration
public string NoDataMessage { get; set; }
Property Value
System.String
A System.String that starts with "=" is interpreted as expression to calculate the no data message; otherwise - literal string. Supports embedded expressions also. |
NoDataStyle
Gets a Style object specifying the appearance of the no data message.
Declaration
public Style NoDataStyle { get; }
Property Value
Style
A Style object specifying the items's style. |
Sorting
Declaration
[Obsolete("Please use Sortings property instead.")]
public SortingCollection Sorting { get; }
Property Value
SortingCollection
|
Sortings
Gets a SortingCollection that defines the sort column(s), and their type and order for the Table
Declaration
public SortingCollection Sortings { get; }
Property Value
SortingCollection
A SortingCollection that contains the Sorting objects for the Table |
Remarks
Sort expressions sort the data that is displayed to the user after the data is retrieved from the data source.
Methods
OnNeedDataSource(Object, EventArgs)
Declaration
protected virtual void OnNeedDataSource(object sender, EventArgs e)
Parameters
System.Object
sender
|
System.EventArgs
e
|
Events
NeedDataSource
Occurs when the processing of the data item processing instance (i.e., DataItem instance) begins and this instance has no DataSource property set.
Declaration
public event EventHandler NeedDataSource
Event Type
System.EventHandler
|
Remarks
The event is hooked on the definition DataItem instance, but the sender object in the event handler is the processing DataItem instance. The processing instance of the data item inherits its DataSource from the definition instance, but if neither has DataSource set, this event is raised.
Examples
The following example demonstrates how to implement a NeedDataSource event handler:
void table1_NeedDataSource(object sender, EventArgs e)
{
Telerik.Reporting.Processing.DataItem processingDataItem = (Telerik.Reporting.Processing.DataItem)sender;
Telerik.Reporting.Processing.Report processingReport = processingDataItem.Report;
object processingParameterValue = processingReport.Parameters["parameter1"].Value;
processingDataItem.DataSource = GetData(processingParameterValue);
}
static object GetData(object value)
{
// Implement your custom data retrieval logic instead
return new string[] { "Sofia", "London", "Tokyo" };
}
Private Sub table1_NeedDataSource(sender As Object, e As EventArgs)
Dim processingDataItem As Telerik.Reporting.Processing.DataItem = DirectCast(sender, Telerik.Reporting.Processing.DataItem)
Dim processingReport As Telerik.Reporting.Processing.Report = processingDataItem.Report
Dim processingParameterValue As Object = processingReport.Parameters("parameter1").Value
processingDataItem.DataSource = GetData(processingParameterValue)
End Sub
Private Shared Function GetData(value As Object) As Object
' Implement your custom data retrieval logic instead
Return New String() {"Sofia", "London", "Tokyo"}
End Function
Explicit Interface Implementations
IDataFlow.Filters
Declaration
IList<Filter> IDataFlow.Filters { get; }
Returns
System.Collections.Generic.IList<Filter>
|
Implements
IDataFlow.Sortings
Declaration
IList<Sorting> IDataFlow.Sortings { get; }
Returns
System.Collections.Generic.IList<Sorting>
|