I am trying to build a calendar that would show all of the employees and if they worked that day in a month. I plan on making it a table. What would be the best way to do this?
class Workers{
int ID,
string name,
list<Work> workDates
}
class Work{
dateTime date
}
I'm trying to use nested repeaters. I can already populate the header with the dates. I have also already figured out how to put all the employees and the days they worked. I just have a problem with placing the shift on the spot where the header date is.
I followed this code I found here for my structure:
<tr class="headerRow">
<td> </td>
<asp:Repeater ID="rptDates" runat="server" OnItemDataBound="rptDate_ItemDataBound">
<ItemTemplate>
<td class="header"><asp:Literal ID="litDates" runat="server"></asp:Literal></td>
</ItemTemplate>
</asp:Repeater>
</tr>
<asp:Repeater ID="rptName" runat="server" ItemDataBound="rptName_ItemDataBound">
<ItemTemplate>
<tr>
<td><asp:Literal ID="litName" runat="server"></asp:Literal></td>
<asp:Repeater ID="rptShifts" runat="server" OnItemDataBound="rptShifts_ItemDataBound">
<ItemTemplate>
<td><asp:Literal ID="litShifts" runat="server"></asp:Literal></td>
</ItemTemplate>
</asp:Repeater>
</tr>
</ItemTemplate>
</asp:Repeater>
</table>
Currently, my code outputs something like this:
| | 04-01-2019 | 04-02-2019 | 04-03-2019 | 04-04-2019 |
|---------|------------|------------|------------|------------|
| Worker1 | 04-03-2019 | 04-04-2019 | | |
| Worker2 | 04-05-2019 | | | |
| Worker3 | 04-01-2019 | 04-03-2019 | | |
Aucun commentaire:
Enregistrer un commentaire