This is a migrated thread and some comments may be shown as answers.

List binding to collection of a Datasource

2 Answers 513 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Markus
Top achievements
Rank 1
Markus asked on 15 Sep 2011, 10:10 AM
Hi All,

I have a question for binding syntax of the report list control. I set the datasource of my report code behind and can now read the values with e.g. [=Fields.Name]. Now i have a list control in my report and have to insert a binding expression for the collection which can be found in the datasource. So what is the Syntax to bind to the property e.g. Datasource.Adresses and get the Values from Adress to display them in a textbox located in the list control.

Best regards Markus

2 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 20 Sep 2011, 02:43 PM
Hi Markus,

The ReportItem.DataObject expression references the parent's data item (in your case report). In this line of thoughts the ReportItem.DataObject.Myfield retrieves the field data from the master report's datasource when used as List's SqlDataSource parameter value. Thus our suggestion is to use datasource components relations capability. For example when SqlDataSource1 is set to the master report and SqlDataSource2 is set to the SubReports. You can set SqlDataSource2 datasource parameter to a SqlDataSource1 field as shown in the following example:

 

 Name

 Type

Value 

 @MyField

String

= ReportItem.DataObject.MyField



Best wishes,
Steve
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Brad Harrison
Top achievements
Rank 1
answered on 21 Sep 2011, 02:48 PM
Markus,

I've been doing this through code since early on. The event handles binding the table to the already existing sub collection.

Private Sub Table1_NeedDataSource(sender As Object, e As System.EventArgs) Handles Table1.NeedDataSource
    Dim tbl As Telerik.Reporting.Processing.Table = DirectCast(sender, Telerik.Reporting.Processing.Table)
    Dim c As MyObjectLibrary.MyObject
    c = DirectCast(tbl.DataObject.RawData, MyObjectLibrary.MyObject)
    tbl.DataSource = c.MyObjectSubCollection
End Sub
Tags
General Discussions
Asked by
Markus
Top achievements
Rank 1
Answers by
Steve
Telerik team
Brad Harrison
Top achievements
Rank 1
Share this question
or