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

Binding nested lists

5 Answers 440 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Andreas
Top achievements
Rank 1
Andreas asked on 13 Aug 2012, 02:49 PM

This is probably just a noob question - and had I done a more thorough job reading through documentation, I'm sure I'd figure it out. However, we're running low on time so I need to check here.

I have a class structure as shown below (very simplified):

public class TestSuite
{
    public String SomeProp { get; set; }
    public List<TestCase> TestCases { get; set; }
}
  
public class TestCase
{
    public String SomeProp { get; set; }
    public Boolean SomeOtherProp { get; set; }
    public List<Message> TestCaseMessages { get; set; }
}
  
public class Message
{
    public String SomeProp { get; set; }
    public Boolean SomeOtherProp { get; set; }
}

In my report I have the following (again simplified) structure

TestSuite header 

-  List (bound to TestSuite.TestCases)

  -  List (bound to TestCase.TestCaseMessages)

The outer list (TestCases) works great and I can access properties without issue, however the inner list (bound to TestCaseMessages) never shows any data if I use a DataSource through the DataSource wizard. On the other hand, if I set a Binding on the inner ListBox's DataSource to Fields.TestCaseMessages (relying on the DataSource of the outer list) - I can manually write Fields.SomeProp in bindings on TextBoxes inside the inner list.

I know this sounds a bit confusing - but what I would really like is for the DataSource setup to work through the wizard/property grid and not having to hack it manually. Am I doing something wrong here - or is this a bug?

Regards,

Andreas

5 Answers, 1 is accepted

Sort by
0
IvanY
Telerik team
answered on 14 Aug 2012, 03:16 PM
Hello Andreas,

Actually this is the current way Telerik Reporting handles such master - child data relations. In order to be easier for you to set the fields you can create a data source from TestCase.TestCaseMessages and assign it to the DataSource property of the List. Once this is done fill in all your Textboxes with the respective expressions. When you are ready just delete the data source and set the binding.

Regards,
IvanY
the Telerik team

BLOGGERS WANTED! Write a review about Telerik Reporting or the new Report Designer, post it on your blog and get a complimentary license for Telerik Reporting. We’ll even promote your blog and help bring you a few fresh readers. Yes, it’s that simple. And it’s free. Get started today >

0
Andreas
Top achievements
Rank 1
answered on 16 Aug 2012, 03:17 PM

Hi Ivan,

Thanks for the answer.

Are there any plans to change this behavior to a more intuitive datasource-approach (like what is possible on top-level bindings)?

Regards,

Andreas

0
IvanY
Telerik team
answered on 17 Aug 2012, 10:48 AM
Hi Andreas,

A binding is a dynamic expression and is used when some data is not known at design time and might be subject of change at runtime. It could even be data that will be generated at runtime. This gives great flexibility to your reports, but has some limitations, the most considerable one being the fact that you do not have design time support.

When the data is not known at design time it is not possible to provide this kind of support so the best approach in general would be the one proposed above.

Regards,
IvanY
the Telerik team

BLOGGERS WANTED! Write a review about Telerik Reporting or the new Report Designer, post it on your blog and get a complimentary license for Telerik Reporting. We’ll even promote your blog and help bring you a few fresh readers. Yes, it’s that simple. And it’s free. Get started today >

0
Anna
Top achievements
Rank 1
answered on 30 Nov 2018, 09:00 AM
Can you give an example please how you set binding in this case? Thanks
0
Silviya
Telerik team
answered on 05 Dec 2018, 07:19 AM
Hi Anna,

Please refer to this excellent KB article on the topic with a given example - How to Databind to Collection Properties.

Regards,
Silviya
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
Andreas
Top achievements
Rank 1
Answers by
IvanY
Telerik team
Andreas
Top achievements
Rank 1
Anna
Top achievements
Rank 1
Silviya
Telerik team
Share this question
or