Keeping my style information in one place
-
I have a standards/best practices question for ASP.NET webforms. I'm making a new website that may draw tables onto the page showing reports (depending on user inputs). The style for these tables is in my CSS file. I want to have the header row of a table that I create in the code-behind have a special style, and I can do that by putting style information in the code-behind (with the TableRow.Style.Add() method), but I'd rather pull the information from the CSS file so I only have one place to maintain style elements at. Is there a standard way of doing this?
-
I have a standards/best practices question for ASP.NET webforms. I'm making a new website that may draw tables onto the page showing reports (depending on user inputs). The style for these tables is in my CSS file. I want to have the header row of a table that I create in the code-behind have a special style, and I can do that by putting style information in the code-behind (with the TableRow.Style.Add() method), but I'd rather pull the information from the CSS file so I only have one place to maintain style elements at. Is there a standard way of doing this?
-
Can't you assign CSS classes in the code-behind as well? Instead of tr.Style.Add("font-family", "Verdana") or whatever, you say tr.CssClass = "mySpecialRowStyle"...
-
Yeah - The use of CssClass as a habit ends up avoiding a ton of headaches - especially as you get into enterprise sized projects with multi-level theming/css..
Safety Programs: Safe Patient Handling | Hospital Patient Safety Nurse Resources: Nurse Injury Prevention
| Medical Back Injury Prevention -
Yeah - The use of CssClass as a habit ends up avoiding a ton of headaches - especially as you get into enterprise sized projects with multi-level theming/css..
Safety Programs: Safe Patient Handling | Hospital Patient Safety Nurse Resources: Nurse Injury Prevention
| Medical Back Injury Prevention"as a habit" is an understatement - if you dont stick to only cssclass and try to integrate with ANY other (non .net) code or systems, this will be a nightmare. So, jkeelerz - I couldnt agree more: as a RULE for me though ;)
By Day: east bay hauling - pleasant hill hauling - moraga junk removal By Night: hack it til I can build it