Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

.NET Forum


You are currently viewing our .NET Forum as a guest. Please register to participate.
Login



Reply
ASP.Net / Table / CSS Question
Old 10-26-2007, 02:12 PM ASP.Net / Table / CSS Question
Silent77's Avatar
Ultra Talker

Posts: 269
Name: Silent
Location: Ohio
Trades: 0
I am trying to apply some css hover effects to the code below...
Code:
Dim Table AsNew HtmlControls.HtmlTable
Dim Desc1 AsNew Label
Dim tdcDesc1 AsNew HtmlControls.HtmlTableCell
Dim tbrRow1 AsNew HtmlControls.HtmlTableRow
 
With Desc1
.Text = "Description1"
.Style.Add("color", "#666666")
EndWith
 
With tdcDesc1
.Controls.Add(Desc1)
EndWith
 
With tbrRow1
With .Cells
.Add(tdcDesc1)
EndWith
EndWith
 
With Table
With .Rows
.Add(tbrRow1)
EndWith
.CellPadding = "1"
.CellSpacing = "1"
.Border = "1"
EndWith
 
PlaceHolder1.Controls.Add(Table)
I am trying to add a css hover to the table background... how would I add a name to this table that is accessible from the external CSS page? Thanks
__________________
Firefox
rediscover the web

Please login or register to view this content. Registration is FREE
Down with internet explorer!
Silent77 is offline
Reply With Quote
View Public Profile Visit Silent77's homepage!
 
 
Register now for full access!
Old 10-26-2007, 02:23 PM Re: ASP.Net / Table / CSS Question
Learning Newbie's Avatar
Defies a Status

Latest Blog Post:
Astounding Republican Paranoia
Posts: 5,662
Name: John Alexander
Trades: 0
First, with blocks suck - don't use them. Bad coding style. The same goes for html tables when you're displaying anything but tabular data.

Next, let's ditch the .Style.Add and instead give it a CSS class. There's even a property for most if not all ASP.NET server controls called CssClass, you would just assign that. In your CSS file, put :hover after the name of the class and add the styles there. That's in addition to the normal definition, not replacing it.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Learning Newbie is offline
Reply With Quote
View Public Profile
 
Old 10-26-2007, 03:00 PM Re: ASP.Net / Table / CSS Question
Silent77's Avatar
Ultra Talker

Posts: 269
Name: Silent
Location: Ohio
Trades: 0
I redid the code to something like this...

ASP Code Behind:
Code:
Dim Table AsNew HtmlControls.HtmlTable
Dim Desc1 AsNew Label
Dim Desc2 AsNew Label
Dim tdcDesc1 AsNew HtmlControls.HtmlTableCell
Dim tdcDesc2 AsNew HtmlControls.HtmlTableCell
Dim tbrRow1 AsNew HtmlControls.HtmlTableRow
With Desc1
.Text = "Description1"
EndWith
With Desc2
.Text = "Description2"
EndWith
With tdcDesc1
.Controls.Add(Desc1)
.ID = "TestingID"
EndWith
With tdcDesc2
.Controls.Add(Desc2)
EndWith
With tbrRow1
With .Cells
.Add(tdcDesc1)
.Add(tdcDesc2)
EndWith
EndWith
With Table
With .Rows
.Add(tbrRow1)
EndWith
.CellPadding = "1"
.CellSpacing = "1"
.Border = "1"
EndWith
ASP:
Code:
<tableid="Table"class="table1"runat="server">

</table>
CSS:
Code:
#table1.td
{
background-color:#0000FF;
}
So the question is why is the css not being applied to that table?
__________________
Firefox
rediscover the web

Please login or register to view this content. Registration is FREE
Down with internet explorer!
Silent77 is offline
Reply With Quote
View Public Profile Visit Silent77's homepage!
 
Old 10-26-2007, 03:34 PM Re: ASP.Net / Table / CSS Question
Learning Newbie's Avatar
Defies a Status

Latest Blog Post:
Astounding Republican Paranoia
Posts: 5,662
Name: John Alexander
Trades: 0
Try a space between table1 and .td? As well you need a space between <table and id= I'm not sure if that's just the way the code is being displayed here?
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Learning Newbie is offline
Reply With Quote
View Public Profile
 
Old 10-26-2007, 07:37 PM Re: ASP.Net / Table / CSS Question
Silent77's Avatar
Ultra Talker

Posts: 269
Name: Silent
Location: Ohio
Trades: 0
Nope still not working... I have no idea why.
__________________
Firefox
rediscover the web

Please login or register to view this content. Registration is FREE
Down with internet explorer!
Silent77 is offline
Reply With Quote
View Public Profile Visit Silent77's homepage!
 
Old 10-29-2007, 06:23 PM Re: ASP.Net / Table / CSS Question
Learning Newbie's Avatar
Defies a Status

Latest Blog Post:
Astounding Republican Paranoia
Posts: 5,662
Name: John Alexander
Trades: 0
I can only assume you're using FireFox. Get Firebug, right click and select "Inspect Element". Over on the right you'll see everything about what CSS the browser is applying.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Learning Newbie is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to ASP.Net / Table / CSS Question
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.24774 seconds with 12 queries