Hello,
I'm fairly new to Telerik Reporting. I am more familiar to ActiveReports by DataDynamics. Their software package has an event called Detail_Format that allows you access to the detail section of each individual item in the subreport. Is there a way to do this in Telerik SubReports?
I have attachd an image to help explain my issue.
There is 1 MainReport and 1 ColorReport (subreport). I set the datasoure for the SubReport object (List<>) and all the data shows up int eh COlorReport properly.
I want to now change the color of the Shape object in the detail section of ColorReport based on individual data in the datasource. When I add a breakpoint in the method SubReport_ItemDataBinding, the subReport has all the items from the datasource list.
It seems to me that SubReport in MainReport should have the full list, but ColorReport should only know about one data item at a time.
Could you please explain how to do this?
Thanks!
Sarah
| private void chart1_NeedDataSource(object sender, EventArgs e) |
| { |
| chart1.Width = Unit.Pixel(300); |
| chart1.Height = Unit.Pixel(300); |
| ChartSeries s = new ChartSeries(); |
| s.Name = "NameOfSerie"; |
| s.Type = ChartSeriesType.Pie; |
| for (int i = 1; i < 6; i++) |
| { |
| ChartSeriesItem item = new ChartSeriesItem(); |
| item.YValue =i* 3.5; |
| item.Label.TextBlock.Text = "A" + i.ToString(); |
| s.Items.Add(item); |
| } |
| s.Appearance.LegendDisplayMode =ChartSeriesLegendDisplayMode.Nothing; |
| chart1.Series.Add(s); |
| } |
| private void chart1_NeedDataSource(object sender, EventArgs e) |
| { |
| string sql = @"SELECT TOP 10 Production.Product.ListPrice, Production.Product.Name, Production.Product.ProductID FROM Production.Product"; |
| string connectionString ="Data Source=localhost;Initial Catalog=AdventureWorks;Integrated Security=True"; |
| SqlDataAdapter adapter = new SqlDataAdapter(sql, connectionString); |
| DataSet dataSet = new DataSet(); |
| adapter.Fill(dataSet); |
| ChartSeries series = new ChartSeries(); |
| series.DataYColumn = "ProductID"; |
| series.DataLabelsColumn = "Name"; |
| chart1.SeriesOrientation=ChartSeriesOrientation.Horizontal; |
| chart1.Width =Unit.Pixel(300); |
| chart1.Height = Unit.Pixel(300); |
| chart1.Series.Add(series); |
| (sender as Telerik.Reporting.Processing.Chart).DataSource = dataSet.Tables[0].DefaultView; |
| } |
| Public Sub New() |
| InitializeComponent() |
| Try |
| Dim connMAS As SqlConnection = New SqlConnection() |
| Dim cmd As SqlCommand |
| Dim commLoadPortalUserInfo As SqlCommand = connMAS.CreateCommand() |
| connMAS.ConnectionString = Convert.ToString("some connection string") |
| connMAS.Open() |
| cmd = connMAS.CreateCommand() |
| cmd.CommandText = "storedprocedurename" |
| cmd.CommandType = CommandType.StoredProcedure |
| cmd.Parameters.Add("@CompanyID", SqlDbType.VarChar) |
| cmd.Parameters("@CompanyID").Value = Me.ReportParameters("CompanyID").Value |
| Dim da As SqlDataAdapter = New SqlDataAdapter(cmd) |
| Dim ds As DataSet = New DataSet |
| da.Fill(ds) |
| Me.DataSource = ds |
| connMAS.Close() |
| Catch ex As System.Exception |
| System.Diagnostics.Debug.WriteLine(ex.Message) |
| End Try |
| End Sub |
| Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load |
| If (Not Page.IsPostBack) Then |
| ReportViewer1.Report = New RosterReport() |
| ReportViewer1.Report.ReportParameters(0).Value = "Value" |
| ReportViewer1.RefreshReport() |
| End If |
| End Sub |
| End Class |
Hi,
I've been playing around with Telerik Report for just a couple days (basically reading the documentation and watching some videos) and have some questions. They are probable really basic questions, but since I didn't find so far an answer for them in the documentation nor by searching in the forum, I post them here.
I am trying to set a telerik report without having any DataBase conexion, so I thought on using a List (e.g. List<MyClass>) as DataSource.
How should I do this?
Until now, I added the DataSource programmatically, but then how do I connect the properties of the list elements (of type MyClass) with table/list/... cells?
Should I better define somehow the list as a project dataSource? how can I do this?
Does my approach make sense?
As I said at the beginning, I know these are probably beginner's questions, but I'm blocked!
Thanks!
Marta