I have a datalist control in which data is shown in 3 <td> as shown in html.

 <asp:DataList ID="DataList1" runat="server" 
    onitemdatabound="DataList1_ItemDataBound" Width="400px">
<ItemTemplate>
<table style="width: 130px"><tr><td style="width:65px;">
    <asp:Image ID="Image1" runat="server" Width="59px" Height="60px" 
        ImageUrl='<%# "~/User/UserPic/" + Eval("reg_pic") %>' /></td>
    <td style="width:162px;" class="wdth150">
        <asp:Label
        ID="lbl_nam" runat="server" Text='<%# Eval("reg_nam") %>' ForeColor="White"></asp:Label><br />
        <asp:Label ID="lbl_ad" runat="server" Text='<%# Eval("reg_age") %>' 
            ForeColor="White"></asp:Label>
        </td><td style="width:109px" class="wdth120"></td><td>
            <asp:LinkButton ID="LinkButton2" runat="server">Proceed</asp:LinkButton></td></tr>
        </table>
</ItemTemplate>
</asp:DataList>

My problem is that these records are appear very closely i want to show some gap between them i tried to use style="width:120px" but that didn't work.

有帮助吗?

解决方案

You probably need to set padding in class or style to put space at the end of columns

padding:5px;

The padding CSS property sets the required padding space on all sides of an element. The padding area is the space between the content of the element and its border. Negative values are not allowed.

The padding property is a shorthand to avoid setting each side separately (padding-top, padding-right, padding-bottom, padding-left), reference.

其他提示

use

<table cellpadding="0" cellspacing="0" width="100%">

and try to give width in percentage instead of Pixels...

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top