PC Review


Reply
Thread Tools Rating: Thread Rating: 2 votes, 1.00 average.

ASP table background color

 
 
mcolson
Guest
Posts: n/a
 
      22nd Apr 2010
I have a table1 within a table2 within a form. I would like to
progamatically change the color of table1 in my aspx.vb code based on
conditions. How do I connect to the table's properties?

<form id="form1" runat="server">
<div>

<table class="style1">
<tr>
<td>
<table class="style1">
<tr>
<td style="background-color: #009900">
<<----- I neeed to change this.
&nbsp;</td>
<td>
&nbsp;</td>
</tr>
<tr>
<td>
&nbsp;</td>
<td>
&nbsp;</td>
</tr>
</table>
</td>
<td>
&nbsp;</td>
</tr>
<tr>
<td>
&nbsp;</td>
<td>
&nbsp;</td>
</tr>
</table>

</div>
</form>
 
Reply With Quote
 
 
 
 
Family Tree Mike
Guest
Posts: n/a
 
      22nd Apr 2010
On 4/22/2010 4:50 PM, mcolson wrote:
> I have a table1 within a table2 within a form. I would like to
> progamatically change the color of table1 in my aspx.vb code based on
> conditions. How do I connect to the table's properties?
>
> <form id="form1" runat="server">
> <div>
>
> <table class="style1">
> <tr>
> <td>
> <table class="style1">
> <tr>
> <td style="background-color: #009900">
> <<----- I neeed to change this.
> &nbsp;</td>
> <td>
> &nbsp;</td>
> </tr>
> <tr>
> <td>
> &nbsp;</td>
> <td>
> &nbsp;</td>
> </tr>
> </table>
> </td>
> <td>
> &nbsp;</td>
> </tr>
> <tr>
> <td>
> &nbsp;</td>
> <td>
> &nbsp;</td>
> </tr>
> </table>
>
> </div>
> </form>


You can add the attributes runat="server" id="MyCell", and then address
the cell from the server side, setting the BgColor property. Your code
then would be MyCell.BgColor=Color.Red, as an example.

Out of curiosity, why are you using HTML tables rather than asp.net tables?

--
Mike
 
Reply With Quote
 
mcolson
Guest
Posts: n/a
 
      23rd Apr 2010
On Apr 22, 4:04*pm, Family Tree Mike <FamilyTreeM...@ThisOldHouse.com>
wrote:
> On 4/22/2010 4:50 PM, mcolson wrote:
>
>
>
> > I have a table1 within a table2 within a form. *I would like to
> > progamatically change the color of table1 in my aspx.vb code based on
> > conditions. *How do I connect to the table's properties?

>
> > <form id="form1" runat="server">
> > * * *<div>

>
> > * * * * *<table class="style1">
> > * * * * * * *<tr>
> > * * * * * * * * *<td>
> > * * * * * * * * * * *<table class="style1">
> > * * * * * * * * * * * * *<tr>
> > * * * * * * * * * * * * * * *<td style="background-color: #009900">
> > <<----- I neeed to change this.
> > * * * * * * * * * * * * * * * * *&nbsp;</td>
> > * * * * * * * * * * * * * * *<td>
> > * * * * * * * * * * * * * * * * *&nbsp;</td>
> > * * * * * * * * * * * * *</tr>
> > * * * * * * * * * * * * *<tr>
> > * * * * * * * * * * * * * * *<td>
> > * * * * * * * * * * * * * * * * *&nbsp;</td>
> > * * * * * * * * * * * * * * *<td>
> > * * * * * * * * * * * * * * * * *&nbsp;</td>
> > * * * * * * * * * * * * *</tr>
> > * * * * * * * * * * *</table>
> > * * * * * * * * *</td>
> > * * * * * * * * *<td>
> > * * * * * * * * * * *&nbsp;</td>
> > * * * * * * *</tr>
> > * * * * * * *<tr>
> > * * * * * * * * *<td>
> > * * * * * * * * * * *&nbsp;</td>
> > * * * * * * * * *<td>
> > * * * * * * * * * * *&nbsp;</td>
> > * * * * * * *</tr>
> > * * * * *</table>

>
> > * * *</div>
> > * * *</form>

>
> You can add the attributes runat="server" id="MyCell", and then address
> the cell from the server side, setting the BgColor property. *Your code
> then would be MyCell.BgColor=Color.Red, as an example.
>
> Out of curiosity, why are you using HTML tables rather than asp.net tables?
>
> --
> Mike


That may be a good question. I've been tasked with building simple
page, but this is my first asp.net. Kind of learning as I go. I'll
look into the asp.net table.

Thanks.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Background Color Outside of Table =?Utf-8?B?U3RldmVuIFphdHM=?= Microsoft Frontpage 3 3rd Jul 2006 12:08 PM
How to change a table cell's background color? HB Microsoft ASP .NET 4 7th May 2006 09:52 PM
how to set background color in pivot table excel 2003? =?Utf-8?B?U0wgV29uZw==?= Microsoft Access Forms 1 26th May 2004 11:38 AM
Problem with background color of table cell Thanks Microsoft ASP .NET 1 8th Feb 2004 03:33 AM
Table Background Color Not Printing H Weibelt Microsoft Frontpage 4 9th Jul 2003 09:13 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:41 PM.