Binding Data to the ReportViewer Control Dynamically in ASP.NET 2.0 - Binding a customized ObjectDataSource (or business logic) to a ReportViewer control in ASP.NET 2.0
(Page 5 of 6 )
In general, every project contains several classes to deal with business logic. Sometimes I may need reports based on the logic/data given through business logic classes. I try to cover this scenario in this section.
Let us now develop some simple business logic to retrieve information from a text file and provide itself as a data source (or report data source) to the ReportViewer control. The following is the class (SalesInfo.vb), which imitates the columns of the dataset created earlier:
ImportsMicrosoft.VisualBasic
PublicClass SalesInfo
Dim _SalesPersonID As String
Dim _FirstName As String
Dim _SalesQuota As String
Dim _SalesYTD As String
Dim _SalesLastYear As String
Public Property SalesPersonID() As String
Get
Return _SalesPersonID
End Get
Set(ByVal value As String)
_SalesPersonID = value
End Set
End Property
Public Property FirstName() As String
Get
Return _FirstName
End Get
Set(ByVal value As String)
_FirstName = value
End Set
End Property
Public Property SalesQuota() As String
Get
Return _SalesQuota
End Get
Set(ByVal value As String)
_SalesQuota = value
End Set
End Property
Public Property SalesYTD() As String
Get
Return _SalesYTD
End Get
Set(ByVal value As String)
_SalesYTD = value
End Set
End Property
Public Property SalesLastYear() As String
Get
Return _SalesLastYear
End Get
Set(ByVal value As String)
_SalesLastYear = value
End Set
End Property
EndClass
The above class simply contains all the properties which get logically mapped to the dataset columns. Now we need to create another class, which can expose several objects based on the above class. The next section will deal with this issue.
Next: Binding a customized ObjectDataSource (or business logic) to a ReportViewer control in ASP.NET 2.0: code >>
More ASP.NET Articles
More By Jagadish Chaterjee