Search code examples
c#asp.netrepeater

ASP.NET Repeater Item add divider after each row


I have the following Repeater and I am trying to add a divider (dotted line or similar) after each row but the style is getting messed up, what am I doing wrong?

Code:

<ItemTemplate>
<table id="tableItem" runat="server">
<tr>
<td style="width:400px;">
          <%--   <asp:Label ID="lblEmployeeId" runat="server" Text='<%#Eval("EmployeeId") %>' ></asp:Label>--%>
            <asp:HiddenField ID="HdnEmployeeId" runat="server" Value='<%#Eval("EmployeeId") %>' />
            <asp:Literal Text="" runat="server" ID="LiteralUser" ></asp:Literal>
</td>
</tr>
    <tr>
            <td style="width: 100px;">
                <asp:HiddenField ID="HdnRequestId" runat="server" Value='<%#Eval("id") %>' />
                <asp:Label ID="lblDate" runat="server" Text='<%#Eval("Date", "{0:dd/M/yyyy}") %>'></asp:Label>
            </td>
            <td style="width: 80px;">
                <asp:Label ID="lblHours" runat="server" Text='<%#Eval("Hours") %>'></asp:Label>
            </td>
            <td style="width: 50px; font-size:10px;">
                <asp:Label ID="lblPeriod" runat="server" Text='<%#Eval("AMorPM") %>'></asp:Label>
            </td>
            <td style="width: 850px; font-size:10px;">
                <asp:Label ID="lblNote" runat="server" Text='<%#Eval("Note") %>'></asp:Label>
            </td>
            <td style="50px">
                <asp:RadioButtonList ID="rbtVerified" runat="server" >
                    <asp:ListItem Value="1">Accept</asp:ListItem>
                    <asp:ListItem Value="2">Reject</asp:ListItem>
                </asp:RadioButtonList>
            </td>
            <td>
                <asp:TextBox ID="txtNotes" runat="server" ></asp:TextBox>
            </td>
        </tr>
        <tr>
        <td style="width:900px;">
        <asp:Label ID="lblBreak" runat="server" Text="------------------------------------------------------------------------------"></asp:Label>
        </td>
        </tr>
</table>

By Style getting messed up I mean the dotted line is being displayed only under the first column (lblDate) and the lblDate width is expanded.


Solution

  • you can use a separator template and inside it insert <hr />

    <asp:Repeater runat="server" ID="rp">
    <SeparatorTemplate>
        <hr />
    </SeparatorTemplate>
    </asp:Repeater>