Nested table in Telerik reporting?

末鹿安然 提交于 2019-12-22 10:10:33

问题


I couldn't find any solution regarding this matter. If anyone use Telerik and have any idea about this please post. :)

Currently I have an ojbect:

Absence
 -> List<Available> Available

I was successfully pass the List object to the main table and list out the Absence object. However when i try to do something like the ff, I have a mental block and I could not find anyway either on google or on their documentation

------------------------------------------------------------
| ABSENCE                                                  |
------------------------------------------------------------
|  Field1   | Field2                                       |
|                                                          |
|  -----------------------------------------------------   |
|  | Available                                         |   |
|  -----------------------------------------------------   |
|  | Available Field1    | Available Field2            |   |
|  -----------------------------------------------------   |
|                                                          |
|----------------------------------------------------------|
|----------------------------------------------------------|
|  Field1   | Field2                                       |
|                                                          |
|  -----------------------------------------------------   |
|  | Available                                         |   |
|  -----------------------------------------------------   |
|  | Available Field1    | Available Field2            |   |
|  -----------------------------------------------------   |
|                                                          |
------------------------------------------------------------

I cannot find anyway to bind or change the datasource of the subTable to the corresponding sub object How can I archive this kind of result?

Thank you


回答1:


You'll want to use SubReports for this. You can read about them in Telerik's documenation or even read this help page that is specifically about master-detail reports which is like what you are doing.

Basically, you'll create two reports. The Master report will display all the Absence objects. As part of the 'detail' section of that report, you'll place a SubReport. The SubReport will show the second report which will list all the Available objects. Then you can pass a parameter from the master report to the sub report and use a filter so you only see the Availables that correspond to the passed in Absence.

Then remember that the outer report's Data Source should be all the Absences and the inner report's Data Source should be all the Availables.




回答2:


I have had same problem a while ago. I figured out that Telerik Reporting has some kind of bug with nested tables. If I put Table2 (child) as cell content of Table1 (parent) and try to bind data sources (via bindings or in code, no matter) than my child Table2 will always show the same item in all rows. I try to ask in official Telerik forum about that but they just tell me to use SubReport (which, by the way, did not resolve my problem). So I was forced to use List (Telerik Reporting control) as parent content holder. And as you understand it was hard to implement such markup as in Table control.




回答3:


We have just done something slimier to this in a report today.

You can add a list control into the cell of the table. Using binding on the list, bind the dataSource to the property that contains the list. You can then Add Columns in you listbox to display the data.

We are doing this by assigning the table data source as an Object in C#. I assume you could do something similar if using SQL/other datasources by attaching the relevant datasource to the list box and applying a filter with a parameter.



来源:https://stackoverflow.com/questions/7777334/nested-table-in-telerik-reporting

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!