OK, I think I\'m getting mad here... I thought this should be super simple, but I just can\'t figure out how to do that.
This is what I\'m trying to do: I want to cr
I have the same problem and found a way around it. For some reason if you develop a ASP.NET application Microsoft took away add new datasource functionality. The way around is not great but it does work. I use all objects and I use the Enterprise library and I want to use my objects for my reports it only makes sense why they don't enable you to do this. I have no idea why Microsoft would not allow this functionality for web apps.
But that leaves windows apps it works so what I did was create a separate windows project include my objects that I want to bind to in that project and create the report on the forms project. I then bring that report into my Asp.net web app and call it through code. Here is a few pieces of code that I use to do this. This is in VB but could be converted to C#. I also have a drop down list that selects the report that is needed and a case statement that gets the data.
Private Sub LoadReport()
Try
pnlReport.Visible = True
Dim Dal As New DataAccess
Dim objRptOutputData = New Model.RptClientCollection
Dim lr As LocalReport = OutputReportViewer.LocalReport
Dim rds As New ReportDataSource
lr.DataSources.Clear()
OutputReportViewer.Visible = True
OutputReportViewer.ProcessingMode = ProcessingMode.Local
OutputReportViewer.LocalReport.EnableHyperlinks = True
Dim SelectedReport As Integer = 0
If Me.ddlReport.SelectedItem.Value IsNot "" Then
SelectedReport = Me.ddlReport.SelectedItem.Value
End If
Select Case SelectedReport
Case ConstantEnum.Reports.ActiveWaitingList
objRptOutputData = Dal.GetRptClientsByStatus(ConstantEnum.Status.ActiveWaitingList)
lr.ReportPath = "Reporting\Report1.rdlc"
rds.Name = "dsClient"
rds.Value = objRptOutputData
Me.lblCount.Text = "Count: " & objRptOutputData.Count
Case ConstantEnum.Reports.InactiveWaitingList
' This is a small app I have about 15 case statements if it was bigger I would of done this selection a bit different.
End Select
lr.DataSources.Add(rds)
lr.Refresh()
OutputReportViewer.DataBind()
Catch ex As Exception
ExceptionUtility.SendError(ex, "Reports", "LoadReport")
End Try
End Sub
I found this blog very helpful.
When you create a new datasource for your rdlc, in the Dataset Properties dialog:
1) In the Data source drop down, select the namespace that contains the class which contains the public method (see #2).
2) In the Available datasets drop down, select the public method that returns an IQueryable of your business objects.
Is your business object class marked as public? I've seen in a video that it must be public.
did you follow this tutorial?
everything you must do is:
now from your report designer you can choose methods from business classes as dataset and drag and drop field from the DTO classes
when you choose that report to display in the reportviewer, the datasource object will be added for you
Have you seen this earlier version? Is this what you need:
http://msdn.microsoft.com/en-us/library/ms252073(v=VS.80).aspx