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

How access to a Dictionary Values with Key

1 Answer 327 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Simon
Top achievements
Rank 1
Simon asked on 21 Aug 2019, 01:50 PM

Hi,

how can I access to the value of a dictionary with the specification of the key?

The dictionary, named as OperationalTravelIncidentalCostSummary, has the key OperationalTravelIncidentalCostType.Hotel, and

OperationalTravelIncidentalCostType is from type enum.

I have tried the following, but... Error.     

= Fields.OperationalTravelIncidentalCostSummary[OperationalTravelIncidentalCostType.Hotel]

1 Answer, 1 is accepted

Sort by
0
Neli
Telerik team
answered on 26 Aug 2019, 10:11 AM
Hello Simon,

In order to display the values of a property that is a collection itself, you can bind declaratively the data item's DataSource property to a given collection property from your business object and the data item will display all collection items. For example, you can add a List item to the report and set its DataSource to be Fields.OperationalTravelIncidentalCostSummary.

For more information, check How to Databind to Collection Properties KB article. Additionally, you might find helpful this forum post that has attached video, demonstrating the approach: Dictionary object for objectdatasource.

Regards,
Neli
Progress 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
Simon
Top achievements
Rank 1
Answers by
Neli
Telerik team
Share this question
or