Additive HtmlTextWriteStyle

  • Thread starter Thread starter Joris van Lier
  • Start date Start date
J

Joris van Lier

I'm looking to add Additive Styles to a CssStyleCollection, however the
Add(HtmlTextWriteStyle, String) method seems to replace styles (see example
below).
void Style(CssStyleCollection styles)
{
styles.Add(HtmlTextWriterStyle.FontStyle, "italic");
styles.Add(HtmlTextWriterStyle.FontStyle, "bold");
// now expecting Italic + Bold
// however styles.Value == "font-style:bold;"
}

How do I assign styles in an additive way?


Thanks

Joris
 
Nevermind, just had my afternoon-dip....
styles.Add(HtmlTextWriterStyle.FontStyle, "bold");

should be

styles.Add(HtmlTextWriterStyle.FontWeight, "bold");
 
Hi

First of all you are trying to add multiple style with same key...
that is HtmlTextWriterStyle.FontStyle
if you want to use bold as style try
"HtmlTextWriterStyle.FontWeight" enum value...

Thanks & best of luck

Munna

www.munna.shatkotha.com
 
Back
Top