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

TemplateColumn for a Dictionary

2 Answers 71 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 26 Feb 2013, 05:55 PM
Hi all,
I am manually binding a RadGrid to an IList of custom objects using the NeedsDataSource event handler.....working great as long as i have a singleton property for each column that i want to display. Where i am a little confused is how to deal with a Function that returns a list of other values.

In my case, the custom object being bound to has a Function that returns a Dictionary<int,double>.....often only 1 entry, but sometimes up to 3.

What I want to have is a column that displays all the keyvalue pairs, with some formatting.

So, if the custom object had properties like this:
ID =  1
Name = "Object1 Name"
Balances = <1,100>, <2,200>, <3,300>

I would want 3 columns in my grid to look sort of like this:

ID      Name                               Balances
---------------------------------------------------------------------
1        Object1 Name                   ID: 1 contributed $100
                                                 ID: 2 contributed $200
                                                 ID: 3 contributed $300

I am sure it shouldn't be too hard, but i am not really sure how to do it.

Any advice would be greatly appreciated.

Paul


2 Answers, 1 is accepted

Sort by
0
Accepted
Radoslav
Telerik team
answered on 01 Mar 2013, 10:01 AM
Hello Paul,

I am sending you a simple example which demonstrates the desired functionality. Please check it out and let me know if it helps you.

Looking forward for your reply.

Regards,
Radoslav
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Paul
Top achievements
Rank 1
answered on 01 Mar 2013, 02:12 PM
That makes perfect sense.....thanks for the very simple, clear example!

Paul
Tags
Grid
Asked by
Paul
Top achievements
Rank 1
Answers by
Radoslav
Telerik team
Paul
Top achievements
Rank 1
Share this question
or