Is there any way to get div style attributes?

I have a div that I set for the style from overflow: automatically for display: no, depending on which buttons are pressed. Is there a way to get what current style it has and return that value as a string or something in C #?

+3
source share
1 answer

You can point the div element to the runat = "server" tag and access it in code (this is HtmlGenericControl.

You can get / set the Style property for the div control via ".Style.Value".

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

CodeBehind example:

string myStyle = Foo.Style.Value;
Foo.Style.Value = "padding: 0px;";
+6
source

Source: https://habr.com/ru/post/1726248/


All Articles