Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How read(get) css style value of a server-side div in code behind(not set)?

Tags:

c#

css

asp.net

i want to get 'display' css value of a server side div!
the code below does not work :

    if (div.Style["display"] == "none")
    {
        div.Style.Add("display", "table-row");
    }

how can i get that value in c#?

thanks in advance

like image 948
SilverLight Avatar asked Oct 28 '25 03:10

SilverLight


1 Answers

div.Attributes["style"].Add("display", "table-row")

Use this:

if (div.Attributes["style"].ToString().Contains("display:none;")) 
{ div.Attributes.Add("style", "display:table-row"); }

or try

div.Attributes["CLASS"].ToString().Contains("CLASS_NAME")
like image 103
Murat SK Avatar answered Oct 30 '25 16:10

Murat SK



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!