开发者

Adding a div overlay to each item of a repeater control

开发者 https://www.devze.com 2022-12-16 17:59 出处:网络
I\'ve added a div overlay to my repeater control using absolute positioning. Predicably, this simply renders all of the divs in the same place. Is there any way that I can put this overlay over each r

I've added a div overlay to my repeater control using absolute positioning. Predicably, this simply renders all of the divs in the same place. Is there any way that I can put this overlay over each row of my repeater?

<table style="border-style:None;width:350px;border-collapse:collapse;">
<tr>
    <td>
        <b>ID</b>
    </td>
    <td>
        <b>User Name</b>
    </td>
    <td>
        <b>Role</b>
    </td>
    <td>
        <b>Last Logged On</b>
    </td开发者_开发知识库>
</tr>

<asp:Repeater ID="rptUsers" runat="server" 
    onitemdatabound="rptUsers_ItemDataBound">
    <ItemTemplate>
    <div style="position:absolute; top:57px; width:350px; height:16px;" />
    <tr>
       <td>
            <asp:Label id="lblUserID" runat="server" Text='<% # Eval("ID") %>'></asp:Label>
        </td>   
        <td>
            <asp:Label id="lblUserName" runat="server" Text='<% # Eval("UserName") %>' ></asp:Label>
        </td>   
        <td>
            <asp:Label ID="lblUserRole" runat="server" Text='<% # Eval("UserRole") %>' ></asp:Label>
        </td>
        <td>
            <asp:Label ID="lblUserLastLoggedOn" runat="server" Text='<% # ((DateTime)Eval("LastLogin") != DateTime.MinValue) ? Eval("LastLogin") : "Never" %>' ></asp:Label>
        </td>   

    </tr>    
    </ItemTemplate>
 </asp:Repeater>
 </table>


You should not have a <div> as a child of a <table>. You could try moving the <div> into the first <td> and then setting position: relative on the <tr>. Adding position relative will tell the absolutely positioned <div> to position itself relative to the <tr>. You'll likely need to adjust the top and left CSS properties of the <div>.

0

精彩评论

暂无评论...
验证码 换一张
取 消