Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamic style sheet creation problem

Status
Not open for further replies.

vsbc

Programmer
Feb 23, 2009
2
GB
Hi all,
I'm building a web control that creates its styles on the fly during PreRender. This works fine as long as I'm using the Style class as below:
Code:
Style style = new Style();
style.BorderColor = System.Drawing.Color.Black;
style.BorderStyle = BorderStyle.Solid;
...
this.Page.Header.StyleSheet.CreateStyleRule( style, null, "myclass" );

The style gets neatly rendered into the <head> section. The problems occur as soon as I choose one of the derived classes such as TableStyle. The resulting style definition appears to only contain properties that are defined in the base class Style, e.g. Height and Width. Properties like CellPadding, however, are completely ignored.

Has anyone has ever come across this?

Thanks,

Volker
 
Research Themes/Skins for the webforms framework. This will be much easier to manage than dynamically building CSS with code.

Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
 
Thanks, will have a look. But I would still love to know why I can't create a table style.

Cheers,

Volker
 
maybe the style element is only design for "standard" or "simple" styling effects, not sure. but i look at it this way. using OOP to create the actual styles is like using a screwdriver to drive a nail. It's the wrong tool for the job.

Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top