问题
Hey there I'm trying to use a list (Loans) within my ObjectDataSource (objectDataSource1) object on a report, as the DataSource for my Telerik chart on the same report. The majority of the tutorials I have looked at all show the report querying their database with a SQL string. I feel I'm over looking something silly. I've also posted on Telerik and haven't got a response quite yet.
What I want to do is something like this:
chart1.DataSource = objectDataSource1.Loans;
Or to be able to just set it at run time, as I'm doing with the other reporting tools on the report:
[=Fields.CurrentModel.Loans]
Is it possible to use a list within an ObjectDataSource as the DataSource for my Chart? Hopefully this is clear. Thanks a ton in advance!
回答1:
So after looking a bit deeper into it, I found this post on telerik's forums:
http://www.telerik.com/community/forums/reporting/telerik-reporting/build-chart-with-object-data-source.aspx
The charts themselves have "Bindings" where you can set up an expression where you can set the chart's DataSource property to a list on your Object Data source.
Going to the chart's Properties column and click the ellipse button under Bindings:
And from there just set the Property Path and the Expression and you're golden
来源:https://stackoverflow.com/questions/14485241/using-a-list-in-my-objectdatasource-on-my-report-for-the-datasource-of-a-telerik