jeni
jeni

Reputation: 983

table with borders inside listview

I want the table with borders to show inside the list view.I used html table inside list view,but I cant get the border lines(rows and columns)(tried border="2").I tried to get the border using css also,but I cant get the table lines.

code:

<asp:ListView ID="ListView1" runat="server" DataSourceID="SqlDataSource1">
 <LayoutTemplate>

                <table id="Table1" border="2" runat="server" class="TableCSS">
                    <tr id="Tr1" runat="server" class="TableHeader">
                        <td id="Td1" runat="server">OwnedBy &nbsp;</td>
                        <td id="Td2" runat="server">Sharedclass &nbsp;</td>
                        <td id="Td3" runat="server">EffectiveInterest &nbsp;</td>
                        <td id="Td4" runat="server">DeemedInterest &nbsp;</td>
                    </tr>
                    <tr id="ItemPlaceholder" runat="server">
                    </tr>
                </table>
            </LayoutTemplate>
<asp:listview>

css:

.TableCSS
        {
            border-bottom-width:thin;
            border-left-width:thin;
            border-bottom-color:Black;        

            background-color:Red;
            width:auto;
            }
        .TableHeader
        {
            border:12px;
            background-color:black;
            color:Snow;
            font-size:11px;
            font-family:Verdana;
            height:auto;
            text-align:center;
            }    

Upvotes: 0

Views: 3477

Answers (4)

user3666491
user3666491

Reputation: 1

Inside <td> hard code the styling as: style="border: thin solid #C0C0C0". Change the border color as you want.

Upvotes: 0

Nir
Nir

Reputation: 356

Notice that the class you gave the table is not the same as what you declared in your css (i.e. class="Table" VS .TableCSS) Also, you can declare a header for each column with <th>.

Upvotes: 0

Sudhakar B
Sudhakar B

Reputation: 1563

To see the table lines, set background for the table and give cellspacing="1"(Add cellspacing attribute to your Table tag) and apply the background color for all TD tags inside table.

Upvotes: 1

Related Questions