Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you change the style of a div programmatically

How do I change the style (color) of a div such as the following?

"<div id=foo class="ed" style="display: <%= ((foo.isTrue) ? string.Empty : "none") %>">
                        <%= ((foo.isTrue) ? foo.Name: "false foo") %>"`
like image 771
Joe Avatar asked Sep 20 '08 19:09

Joe


1 Answers

Try this: in the .aspx file put thees lines

<div id="myDiv" runat="server">
    Some text
</div>

then you can use for example

myDiv.Style["color"] = "red";
like image 62
starec Avatar answered Oct 29 '22 00:10

starec