Dictionary object for objectdatasource

5 posts, 1 answers
  1. kid
    kid avatar
    14 posts
    Member since:
    May 2016

    Posted 18 May Link to this post

    I am a new for Telerik, I create a objectdatasource List<Dictionary<string, object>>

     

    my mock data :
    data['key1'] = 'value1'

    I used below expression to display the value, but not support

    = ReportItem.DataObject.key1 ? not support... 

    how can I display the key value in tempalte?

     

     

     

     

     

     

  2. Stef
    Admin
    Stef avatar
    3053 posts

    Posted 19 May Link to this post

    Hello kid,

    Please check the attached video that illustrates how to bind to collection properties based on How to Databind to Collection Properties and How to use the ReportItem.DataObject property in expressions.

    Keys and Values can be accessed via Fields.Keys and Fields,Values in expressions.

    The video is a SWF file that can be previewed in IE browser.

    Regards,
    Stef
    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. kid
    kid avatar
    14 posts
    Member since:
    May 2016

    Posted 23 May in reply to Stef Link to this post

    Cool~~~

     

    but my report only display a form.

    e.g.

    First Name: Fields['firstName']        Last Name : Fields['lastName']

    Mobile      : Fields['mobile']              Email          : Fields['email']

    Address :  Fields['address']

     

     

    How can do it?

     

      

     

  5. kid
    kid avatar
    14 posts
    Member since:
    May 2016

    Posted 23 May in reply to kid Link to this post

    Fields is an object of Dictionary<string, object>
  6. Answer
    Stef
    Admin
    Stef avatar
    3053 posts

    Posted 25 May Link to this post

    Hello,

    The fields names will be the name of the direct properties of the wrapped business object. If it is a List of Dictionary, there will be fields like Keys and Values.

    In your case, you can test using custom functions to get the desired values from the data object. In case of designing reports with the Standalone Report Designer, the designer will have to load the custom assembly with the user functions - Extending Report Designer (tutorials are available at the bottom of the article).


    You can pass the current container's data object to the user function by using ReportItem.DataObject in expressions.


    I hope this information is helpful.

    Regards,
    Stef
    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
DevCraft banner