Within codebehind in an ASPX page I get few details about the employees (read from external data source). Finally I would like to show in the below fashion. The display of below may be showin incorrect but is a simplpe table with header/column approach.
___________________________________________________________________________________
| DEPT | HR | |__________________________________________________________________________________|
| Employee Image | Emp Name | Hire Date |
|____________________________________|_____________________________________________|
| Steve.gif | Steve Jobs | 22/05/1979 |
|____________________________________|_____________________________________________|
| Mark.gif | Mark Miller | 22/05/1949 |
|____________________________________|_____________________________________________|
| DEPT | Operations | |__________________________________________________________________________________|
| Employee Image | Emp Name | Hire Date |
|____________________________________|_____________________________________________|
The data is collected from various data sources and is finally available within the codebehind. I want to display in the above fashion.
What is the best approach? I thought of creating a htmldivcontrol and adding all these values. Finally I will bind div tag to the page.
Currently I am trying with approach but want to know if there are any better approaches.
Please share your views and exaamples. _
The best approach in my opinion, would be to use a Repeater like this:
And then on your code behind, something like:
You would need to bind your grid to a
List<Employee>
whereEmployee
would be defined like so:But they must be ordered by Department previously to being bound.
Sample code to Populate the repeater
Produces