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

BindingList in ObjectDataSource

3 Answers 152 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Martin Gartmann
Top achievements
Rank 2
Martin Gartmann asked on 22 Nov 2015, 11:47 AM

Dear users,

i want to use a class from my project to generate a report. i am able to use Public Property's from my class as long as it holds just one value with success

When i try to use a property like (remark: i want to print all values in it as a list)

Public Property douRundenZeiten As New BindingList(Of Double)        ' Feld mit allen Rundenzeiten - Messwerte

instead of the values the report shows  System.ComponentModel.BindingList1[System.Double] in the tablecell (table wizard as used)

Why will this happen and how to access the real values from the BindingList

A close by behavior also happens when i read in an xml file like

<?xml version="1.0" encoding="utf-8"?>
<TicketRun>
  <Fahrer>
    <Pos>1</Pos>
    <Kart>8</Kart>
    <NameOfDriver>Kart-Nr. 08</NameOfDriver>
    <Rnd>13</Rnd>
    <Rundenzeiten>
      <Laptime>120,06</Laptime>
      <Laptime>119,15</Laptime>
      <Laptime>126,12</Laptime>
      <Laptime>159,8</Laptime>
      <Laptime>147,46</Laptime>
      <Laptime>119,07</Laptime>
      <Laptime>119,22</Laptime>
      <Laptime>120,2</Laptime>
      <Laptime>119,64</Laptime>
      <Laptime>120,3</Laptime>
      <Laptime>120,2</Laptime>
      <Laptime>120,85</Laptime>
      <Laptime>121,34</Laptime>
    </Rundenzeiten>
    <Best>119,07</Best>
    <Speed>19,05</Speed>
  </Fahrer>

Using

Function ReadTicketWithTimesXml(xmlfile As String)
       Dim ds As New DataSet
       xmlfile = "e:/karatris/LTR.xml"
       ds.ReadXml(xmlfile)
       Return ds.Tables("Fahrer")
   End Function

and use this function as a source for an objectdatasource all values can be used in a report except the <Rundenzeiten> <Laptime> values.

The Report shows  System.Data.RelatedView in the table cell instead of the values.

Using the same xml in Altova Style Vision works like a charm for generating HTML Reports.

What is the reasons why it does not work the same way in reporting. Where is my mistake?

Attached is the view how the objectdatasource looks in visual studio 2012.

Any help is welcome

Martin Gartmann
 

3 Answers, 1 is accepted

Sort by
0
Nasko
Telerik team
answered on 23 Nov 2015, 03:34 PM
Hello Martin,

There is a business object with data, which contains other business objects within itself. When there is another business object property within your business object we do not drill down into the hierarchy. To use the inner object you have to bind a separate Data Item to it using expressions and Bindings. For more detailed information, please follow the Use DataObject as data source for nested data items (Table, List, Crosstab, Graph) section of the How to use ReportItem.DataObject property in expressions article. This way you can bind the DataSource property of a data item to a given object/collection property from your business object and the data item will display the inner items.
Note that the inner items will not be visible in the expression editor at design-time, so you will need to type the data field names manually in expressions.

Regards,
Nasko
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Martin Gartmann
Top achievements
Rank 2
answered on 23 Nov 2015, 07:25 PM

Dear Nasko,

what i want to do is to place a list in one column of a wizard created table. This list is bound to the nested Rundenzeiten part of my xml, named Fields.Fahrer_Rundenzeiten in my ObjectDataSource (Screenshot see initial post). I have placed a textbox in the list (datasource = fields.Fahrer_Rundenzeiten) and set the value to =Fields.Laptime, because this is defined in the XML.

Result: An error has occurred while processing TextBox 'TextBox14': The expression
contains object 'Laptime' that is not defined in the current context.

See the attached screenshot. I also do not see a field like this in the ObjectDataSource

 Could you lead me to my mistake?

Kind regards

 

 

0
Nasko
Telerik team
answered on 26 Nov 2015, 03:39 PM
Hello Martin,

As elaborated in my previous reply, you will need to a data item inside the Table cell and bind it to data. Please find attached a sample project demonstrating the approach.

Regards,
Nasko
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
Martin Gartmann
Top achievements
Rank 2
Answers by
Nasko
Telerik team
Martin Gartmann
Top achievements
Rank 2
Share this question
or