1

Suppose i'm having <div> tag with id="toggleText" & runat="Server" then i can change style attributes by using following -

toggleText.Style.Add("Display", "block");

But if i want to retrieve the style attribute then how to do this?

thanks

Priyanka
  • 2,802
  • 14
  • 55
  • 88

2 Answers2

3

Easy:

 toggleText.Style["Display"];
Andy Stannard
  • 1,673
  • 2
  • 18
  • 32
1

When you query the control's Style property you get "a collection of all cascading style sheet (CSS) properties applied to a specified HTML server control in the ASP.NET file" - there's a code sample on that page as well.

stuartd
  • 70,509
  • 14
  • 132
  • 163