Repeater with Multiple Type binding
I am in situation where I need to bind multiple types to a single repeater.
Say for example I have 2 types in different namespaces
abc.businessLayer.Type_A [properties - Name(string), Country(string)]
xyz.businessLayer.Type_B [properties - FirstName(string), Location(string)]
Now I need to bind the repeater with the combined results of above 2 type collection开发者_高级运维 with the repeater column names "Full Name" and "Country".
I am planning to add a new Type_C.cs in the application layer and iterate the A and B type collection to assign the properties in C and finally bind the repeater with Type_C.
Can someone let me know if there is better way to go with such kind of issue?
You should write a method that returns a datatable of a combination of the 2 different collections and bind to that method. Ideally this would sit in the BLL in an n tier application
If this data is coming from some database, then return it the way you want to display on the UI. You should probably have a new class/entity that contains the properties for the fields you need to show in the control. It should also have some field/property that help for unique identification of a record.
精彩评论