How to pass style in html tag in aspx.cs page?

Solution for: how to pass style in html tag in aspx.cs page?

I had got simple solution is below type this line in aspx.cs.

Write the below code into aspx page.


<div runat="server" id="divid">
</div>

And write the below code into aspx.cs page.


divid.Attributes.CssStyle.Add("property name","value");

Like below example:


divid.Attributes.CssStyle.Add("opacity","0.5");

About the Author

avatar