Showing posts with label asptable. Show all posts
Showing posts with label asptable. Show all posts

Wednesday, March 28, 2012

TableCell: BackColor Property But No BackGround Property?

I am using an ASP:Table Control to make a table. I know that the HTML TD tag
has a background attribute and a bgcolor attribute. The TableCell has a
BackColor property, which is the equivelant of the HTML bgcolor attribute,
but what can I use as an equivelant for the HTML background attribute?
Thanks.
--
Nathan Sokalski
njsokalski@dotnet.itags.org.hotmail.com
http://www.nathansokalski.com/I would have to look but my first thought is this. The control will render
whatever attribute you add. So you can add it declaratively with
attribute="value" syntax or on in the code you can add it through the
Attributes collection on the control.

C#
control.Attributes.Add("Name", "Value");

I think you can do this too, because I think it is a NameValueCollection
which means it handles the add automatically.
control.Attributes["Name"] = "Value";

"Nathan Sokalski" wrote:

> I am using an ASP:Table Control to make a table. I know that the HTML TD tag
> has a background attribute and a bgcolor attribute. The TableCell has a
> BackColor property, which is the equivelant of the HTML bgcolor attribute,
> but what can I use as an equivelant for the HTML background attribute?
> Thanks.
> --
> Nathan Sokalski
> njsokalski@.hotmail.com
> http://www.nathansokalski.com/
>

TableRow Borders

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 individu
al 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 thi
s, I get no errors, but not
hing happens. The goal is to outline one of the rows of the table (a box aro
und the whole TableRow, not around each of the row's cells). These propertie
s of the TableRow object don't seem to do anything. Can you help? Do I need
to use styles? If so, how?
Thanks!
AlexHi 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.)
Two things:
1. If I set the borders of all of the cells in the Row, it has a different l
ook. 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. o
nly the top and left side of a cell, etc.)?
Also, just out of curiosity, what's the point in having BorderStyle, etc. fo
r the TableRow class if it doesn't do anything?
Thanks.
Alex
-- [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.
Luke
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

TableRow Borders

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

AlexHi 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.)
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.
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.)

Tuesday, March 13, 2012

td tag generating faulty code

I have created a user control using asp:table control. The control generates
a single column menu controls with 5 rows. each row is supposed to have a
image in link tag. The problem is that ASP.Net framework generates closing
"td" tags on new line. This causes to show extra white pixels at the bottom
of each image. This is because of a known bug in "IE" where it has issues
with closing "td" tag on new line.
Question .... is there a way to control the HTML tags generated by ASP.Net
controls so that I can get the UI the way I want it?
Thanks
Naveen K Kohli
http://www.netomatix.comYou would have to override the Render method of the server control, or
possible create a custom control where you specify the HTML to rendered.
David Lloyd
MCSD .NET
http://LemingtonConsulting.com
This response is supplied "as is" without any representations or warranties.
"Naveen K Kohli" <naveenkohli@.hotmail.com> wrote in message
news:#xNFQq#VFHA.1384@.TK2MSFTNGP09.phx.gbl...
I have created a user control using asp:table control. The control generates
a single column menu controls with 5 rows. each row is supposed to have a
image in link tag. The problem is that ASP.Net framework generates closing
"td" tags on new line. This causes to show extra white pixels at the bottom
of each image. This is because of a known bug in "IE" where it has issues
with closing "td" tag on new line.
Question .... is there a way to control the HTML tags generated by ASP.Net
controls so that I can get the UI the way I want it?
Thanks
Naveen K Kohli
http://www.netomatix.com