<asp:Panels, borders and HTML tables

Discussion in 'ASP .Net' started by Mark Rae, Oct 6, 2004.

  1. Mark Rae

    Mark Rae Guest

    Hi,

    Is there any way to put a border round several rows in a standard HTML table
    by surrounding them with an asp:panel (or a client-side <div>)? When I try,
    the border doesn't appear, though it does appear if I surround the entire
    table with an asp:panel.

    E.g. this doesn't show the panel's border:

    <table>
    <asp:panel ID=pnlPanel Runat=server BorderColor="Black"
    BorderStyle="Solid" BorderWidth="2px">
    <tr>
    <td>Text</td>
    <td>Text</td>
    </tr>
    <tr>
    <td>Text</td>
    <td>Text</td>
    </tr>
    </asp:panel>
    <tr>
    <td>Text</td>
    <td>Text</td>
    </tr>
    </table>

    but this does:

    <asp:panel ID=pnlPanel Runat=server BorderColor="Black" BorderStyle="Solid"
    BorderWidth="2px">
    <table>
    <tr>
    <td>Text</td>
    <td>Text</td>
    </tr>
    <tr>
    <td>Text</td>
    <td>Text</td>
    </tr>
    <tr>
    <td>Text</td>
    <td>Text</td>
    </tr>
    </table>
    </asp:panel>
     
    Mark Rae, Oct 6, 2004
    #1
    1. Advertising

  2. you should put border on your table cells with your problem. take a look on
    "td" styles.
    or make something like this
    <table>
    <tr>
    <td colspan=2>
    <asp:panel ID=pnlPanel Runat=server BorderColor="Black"
    BorderStyle="Solid" BorderWidth="2px">
    <table>
    <tr>
    <td>Text</td>
    <td>Text</td>
    </tr>
    <tr>
    <td>Text</td>
    <td>Text</td>
    </tr>
    </table>
    </asp:panel>
    </tr>
    <tr>
    <td>Text</td>
    <td>Text</td>
    </tr>
    </table>

    my advice is to look at the table styles, too, and put your border on table
    and eliminate the <asp:panel>

    You should read about table some stuff.
    http://msdn.microsoft.com/workshop/author/dhtml/reference/objects/table.asp?frame=true

    first row on remarks says:
    The following tags are valid in table construction: CAPTION, COL, COLGROUP,
    TBODY, TD, TFOOT, TH, THEAD, and TR.
    sorry to dissapoint you but in this is not put any <asp:panel> or <div>

    "Mark Rae" wrote:

    > Hi,
    >
    > Is there any way to put a border round several rows in a standard HTML table
    > by surrounding them with an asp:panel (or a client-side <div>)? When I try,
    > the border doesn't appear, though it does appear if I surround the entire
    > table with an asp:panel.
    >
    > E.g. this doesn't show the panel's border:
    >
    > <table>
    > <asp:panel ID=pnlPanel Runat=server BorderColor="Black"
    > BorderStyle="Solid" BorderWidth="2px">
    > <tr>
    > <td>Text</td>
    > <td>Text</td>
    > </tr>
    > <tr>
    > <td>Text</td>
    > <td>Text</td>
    > </tr>
    > </asp:panel>
    > <tr>
    > <td>Text</td>
    > <td>Text</td>
    > </tr>
    > </table>
    >
    > but this does:
    >
    > <asp:panel ID=pnlPanel Runat=server BorderColor="Black" BorderStyle="Solid"
    > BorderWidth="2px">
    > <table>
    > <tr>
    > <td>Text</td>
    > <td>Text</td>
    > </tr>
    > <tr>
    > <td>Text</td>
    > <td>Text</td>
    > </tr>
    > <tr>
    > <td>Text</td>
    > <td>Text</td>
    > </tr>
    > </table>
    > </asp:panel>
    >
    >
    >
     
    =?Utf-8?B?UHN5Y2hv?=, Oct 6, 2004
    #2
    1. Advertising

  3. Mark Rae

    Lucifer Guest

    Mark, this is because nothing between <table> and <tr> will render.

    you could try using css to apply style to the rows so that:

    top row has: border top & left and right

    middle rows have: border left and right

    and botton row has: botton left and right

    (might work, havent tried it..)

    e.g.

    <style>
    ..topstyle {
    border-left: solid 1px black;
    border-right: solid 1px black;
    border-top: solid 1px black;
    }
    ..middlestyle {
    border-left: solid 1px black;
    border-right: solid 1px black;
    }
    ..bottomstyle {
    border-bottom: solid 1px black;
    border-left: solid 1px black;
    border-right: solid 1px black;
    };
    </style>

    <table>
    <tr>
    <td>Text</td>
    <td>Text</td>
    </tr>
    <asp:panel ID=pnlPanel Runat=server BorderColor="Black"
    BorderStyle="Solid" BorderWidth="2px">
    <tr class=topstyle>
    <td>Text</td>
    <td>Text</td>
    </tr>
    <tr class=middlestyle>
    <td>Text</td>
    <td>Text</td>
    </tr>
    <tr class=middlestyle>
    <td>Text</td>
    <td>Text</td>
    </tr>
    <tr class=bottomstyle>
    <td>Text</td>
    <td>Text</td>
    </tr>
    </asp:panel>
    <tr>
    <td>Text</td>
    <td>Text</td>
    </tr>
    </table>


    Mark Rae wrote:
    > Hi,
    >
    > Is there any way to put a border round several rows in a standard

    HTML table
    > by surrounding them with an asp:panel (or a client-side <div>)? When

    I try,
    > the border doesn't appear, though it does appear if I surround the

    entire
    > table with an asp:panel.
    >
    > E.g. this doesn't show the panel's border:
    >
    > <table>
    > <asp:panel ID=pnlPanel Runat=server BorderColor="Black"
    > BorderStyle="Solid" BorderWidth="2px">
    > <tr>
    > <td>Text</td>
    > <td>Text</td>
    > </tr>
    > <tr>
    > <td>Text</td>
    > <td>Text</td>
    > </tr>
    > </asp:panel>
    > <tr>
    > <td>Text</td>
    > <td>Text</td>
    > </tr>
    > </table>
    >
    > but this does:
    >
    > <asp:panel ID=pnlPanel Runat=server BorderColor="Black"

    BorderStyle="Solid"
    > BorderWidth="2px">
    > <table>
    > <tr>
    > <td>Text</td>
    > <td>Text</td>
    > </tr>
    > <tr>
    > <td>Text</td>
    > <td>Text</td>
    > </tr>
    > <tr>
    > <td>Text</td>
    > <td>Text</td>
    > </tr>
    > </table>
    > </asp:panel>
     
    Lucifer, Oct 6, 2004
    #3
  4. Mark Rae

    Mark Rae Guest

    "Lucifer" <> wrote in message
    news:...

    Thanks for the reply.

    > you could try using css to apply style to the rows so that:
    > top row has: border top & left and right
    > middle rows have: border left and right
    > and botton row has: botton left and right


    Yes - I was hoping to be able to avoid all that HTML, as it will make it
    really irritating when adding and/or deleting rows and/or columns...

    Looks like I don't have a choice...
     
    Mark Rae, Oct 6, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Michael Wilcox

    Tables with solid black borders?

    Michael Wilcox, Jul 7, 2003, in forum: HTML
    Replies:
    3
    Views:
    23,983
    Michael Wilcox
    Jul 7, 2003
  2. Hostile17

    Borders For Tables Hack

    Hostile17, Sep 2, 2003, in forum: HTML
    Replies:
    2
    Views:
    545
    Philipp Lenssen
    Sep 2, 2003
  3. George
    Replies:
    9
    Views:
    5,052
    George
    Oct 25, 2004
  4. Jon

    Tables and borders

    Jon, May 17, 2005, in forum: HTML
    Replies:
    6
    Views:
    534
    Safalra
    May 20, 2005
  5. ChuckSlayer
    Replies:
    1
    Views:
    154
    ChuckSlayer
    Feb 10, 2007
Loading...

Share This Page