BindingList in ObjectDataSource

4 posts, 0 answers
  1. Martin Gartmann
    Martin Gartmann avatar
    51 posts
    Member since:
    Apr 2004

    Posted 22 Nov 2015 Link to this post

    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
     

  2. Nasko
    Admin
    Nasko avatar
    909 posts

    Posted 23 Nov 2015 Link to this post

    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 a data source for nested data items (Table, List, Crosstab, Graph) section of the How to use ReportItem.DataObject property in expressions help 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
  3. DevCraft banner
  4. Martin Gartmann
    Martin Gartmann avatar
    51 posts
    Member since:
    Apr 2004

    Posted 23 Nov 2015 in reply to Nasko Link to this post

    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

     

     

  5. Nasko
    Admin
    Nasko avatar
    909 posts

    Posted 26 Nov 2015 Link to this post

    Hello Martin,

    As elaborated in my previous reply, you will need to nest 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
Back to Top