I create HtmlGenericControl
like this :
HtmlGenericControl inner_li = new HtmlGenericControl("li");
inner_li.Attributes.Add("style", "list-style-type: none");
How can i get the value of this attribue(style
).
You can do it using indexer:
var style = inner_li.Attributes["style"];
Just a side note: when dealing with styles it's better to use HtmlControl.Style
property:
inner_li.Style[HtmlTextWriterStyle.ListStyleType] = "none";
The Attributes property is name value collection. So you can do
string tempstr = inner_li.Attributes["style"]
.
See the msdn doc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With