How to get the value of a property of a CSS class in code
How can I get the value of a style defined in a CSS class?
The markup has:
CssClass="grdTextBox" Text="aaaaaaaabbbbbbbccccccc"
CSS Style:
.grdTextBox {FONT-SIZE: 12px; FONT-FAMILY: verdana; }
The .cs file has:
string cssClass = txtComments.CssClass;
Response.Write(" cssClass is : " + cssClass);
How can I find the value for the font size or font family from code?
I can find them if they are in a style tag or are attributes of a textbox. But how can you find values ββif they are defined in a CSS class?
0
Geetib
a source
to share
5 answers
I ran into the same problem and I think there might be some solution by opening the .css file and doing a manual search in the requested style, returning its contents.
This will require manual disassembly, and perhaps you have more than one .css file or complex styles that make this decision a little awful, but I think it's better than "impossible".
I would like to hear a more elegant solution.
+1
a source to share