border around table

I cant place a border around a table row in asp.net .
I have tried a few variations but i can do border around a <td> but not <tr>


.tbmyprod1 tr
{
border:1px solid black;
 
}
   <table  class="tbmyprod1">
   
        <asp:ListView ID="lvCatalog" runat="server">
            <LayoutTemplate>
                <asp:PlaceHolder ID="itemPlaceholder" runat="server"></asp:PlaceHolder>
            </LayoutTemplate>

           
            <ItemTemplate>
             <tr >
               
                  <nopcommerce:productbox2 id="ctrlProductBox" product='<%# Container.DataItem %>'  runat="server" />
              <tr >         
           
            </ItemTemplate>
           
        </asp:ListView>
   
   </table>
jagguyAsked:
Who is Participating?
 
jagguyAuthor Commented:
tr is in another file that calls the td.

anyway i solved the datalist as i needed to use the styling in the control to make it work

 <asp:DataList ID="dlProducts" runat="server" RepeatColumns="2" RepeatLayout="Table"
         BorderWidth="1px" BorderColor="black" GridLines="Horizontal"  >

i might close this thread and start another on another control
0
 
John ClaesSenior .Net Consultant & Technical AnalistCommented:
upon the TR you indeed can't set the border, but you can set the borders of the TD's inside the TR
You probably don't want to see the vertical borders inside the row between fields

that is doable using the Styles
http://www.w3schools.com/css/css_border.asp
using the indiviual sides
border-top-style:dotted;
border-right-style:solid;
border-bottom-style:dotted;
border-left-style:solid;

hope to be clear
0
 
Dave BaldwinFixer of ProblemsCommented:
You're right, you can't.  A <tr> has no content of it's own to put a border around.
0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

 
Chris WalshSoftware DeveloperCommented:
Try:
.tbmyprod1 table
{
    border:1px solid black;
}
instead.
0
 
khan_webguruCommented:
Also in your code you are not properly closing <tr> too.

Code it properly to avoid any unexpected results

<tr > //starting

</tr> //Ending
0
 
khan_webguruCommented:
for tr border try to use this

 
.tbmyprod1 tr { 
display:block; 
border:1px solid black; 
}

Open in new window

0
 
jagguyAuthor Commented:
In this example I cant place a bottom border around the 2nd element but i can around the 1st element of a row if there is an odd number of elements to display.

    <table>
    <!--<div class="product-grid">-->
        <asp:DataList ID="dlProducts" runat="server" RepeatColumns="2"
            RepeatLayout="Table" >
            <ItemTemplate>
         
          <nopCommerce:ProductBox1 ID="ctrlProductBox" Product='<%# Container.DataItem %>' runat="server" />
         
            </ItemTemplate>
        </asp:DataList>
   <!-- </div>    -->
 
   </table>

..

   <td class="myproduct">
   
        <asp:HyperLink ID="hlImageLink" runat="server" />
   
 </td>
0
 
jagguyAuthor Commented:
also this didnt work

.tbmyprod1 tr {
display:block;
border:1px solid black;
}

------------------------------
This place a border around the cell but leaves a gap so i dont get a straight border around all cells.

.myproduct-prodLine1a
{
    border-top :1px solid black;
border-bottom :1px solid black;
border-left :1px solid black;
}

.myproduct-prodLine1b
{
    border-top :1px solid black;
border-bottom :1px solid black;

}

.myproduct-prodLine1c
{
    border-top :1px solid black;
border-bottom :1px solid black;
border-right :1px solid black;
}


 <td class="myproduct-prodLine1a">
   
        <asp:HyperLink ID="hlImageLink" runat="server" />
  </td>
  <td class="myproduct-prodLine1b" >
        <asp:HyperLink ID="hlProduct" runat="server" />
 
        <asp:Literal runat="server" ID="lShortDescription"></asp:Literal>
   
   </td>
0
 
khan_webguruCommented:
where are TR is above code???
0
 
jagguyAuthor Commented:
need to redo question
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.