TableRow Borders

G

Guest

Okay, I'm sure that this is an incredibly simple one and it may have more to do with HTML than with ASP.NET

I have an ASP:Table with no borders and that table has several ASP:TableRows, each with several ASP:TableCells in them

I have no trouble setting the BorderWidth, BorderStyle, etc. of the individual TableCells or even of the whole ASP:Table. But what if I want to set the BorderStyle and BorderColor, etc. of one of the ASP:TableRows? When I do this, I get no errors, but nothing happens. The goal is to outline one of the rows of the table (a box around the whole TableRow, not around each of the row's cells). These properties of the TableRow object don't seem to do anything. Can you help? Do I need to use styles? If so, how

Thanks

Alex
 
M

[MSFT]

Hi Alex,

An asp:TableRow will be rendered into <tr> tag by ASP.NET. An asp:table
will be rendered like:

<Table>
<tr>
<td>
...
</td>
</tr>
</Table>

The tag "<tr>" cannot have a border seperately. So do the asp:tablerow. I
think there are several work arounds for this problem:

1. set all cells' border in the row instead.
2. set the row's backgroud color instead. If you want to select/highlight a
row, it is also a good way.

Hope this help.

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
G

Guest

Two things

1. If I set the borders of all of the cells in the Row, it has a different look. What I really need is to be able to outline the whole row. Is there any way to do that, maybe using styles for each of the cells so that I can edge them as I want to? (e.g. only the top and left side of a cell, etc.)

Also, just out of curiosity, what's the point in having BorderStyle, etc. for the TableRow class if it doesn't do anything

Thanks

Ale

----- [MSFT] wrote: ----

Hi Alex

An asp:TableRow will be rendered into <tr> tag by ASP.NET. An asp:table
will be rendered like

<Table><tr><td
..
</td></tr></Table

The tag "<tr>" cannot have a border seperately. So do the asp:tablerow. I
think there are several work arounds for this problem

1. set all cells' border in the row instead
2. set the row's backgroud color instead. If you want to select/highlight a
row, it is also a good way

Hope this help

Luk
Microsoft Online Suppor

Get Secure! www.microsoft.com/securit
(This posting is provided "AS IS", with no warranties, and confers no
rights.
 
M

[MSFT]

Hi Alex,

The BorderStyle on ASP:TableRow will be grant to the <tr> tag in client
browser. Hwoever, these styles didn't work with a <tr> tag.

Your idea for setting style of each cell is also great. Following are code
to achieve this:

Dim count As Integer

Table1.Rows(1).Cells(0).Attributes.Add("style", "BORDER-TOP: ridge;
BORDER-BOTTOM: ridge;BORDER-LEFT: ridge")

Table1.Rows(1).Cells(Table1.Rows(1).Cells.Count -
1).Attributes.Add("style", "BORDER-TOP: ridge; BORDER-BOTTOM:
ridge;BORDER-RIGHT: ridge")

For count = 1 To Table1.Rows(1).Cells.Count - 2

Table1.Rows(1).Cells(count).Attributes.Add("style",
"BORDER-TOP: ridge; BORDER-BOTTOM: ridge")

Next


Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,997
Messages
2,570,241
Members
46,831
Latest member
RusselWill

Latest Threads

Top