Home All Groups Group Topic Archive Search About

getting/chaning attributes on a DIV tag.

Author
20 Feb 2006 3:20 PM
JL
Hi,

I am working on a page where I need to show/hide a DIV tag when a button is
clicked.

Below is how the DIV tag was set up on Page Load:

div.Attributes.Add("style", "display:block;");

Is there a way that when the button is clicked, I can check the value on the
"style" attribute, and if it's "display:block;", to set it to "display:none;"?

Thanks!

Author
20 Feb 2006 9:55 PM
Steve C. Orr [MVP, MCSD]
Yes, you'll need to output a bit of client side JavaScript to handle that as
I've done in this example:
http://SteveOrr.net/articles/VisiPanel.aspx
(The first block in the Render method of Listing One shows that code sample)

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net



Show quoteHide quote
"JL" <J*@discussions.microsoft.com> wrote in message
news:5D6128B4-6A71-4EC9-B6F7-134988C37F83@microsoft.com...
> Hi,
>
> I am working on a page where I need to show/hide a DIV tag when a button
> is
> clicked.
>
> Below is how the DIV tag was set up on Page Load:
>
> div.Attributes.Add("style", "display:block;");
>
> Is there a way that when the button is clicked, I can check the value on
> the
> "style" attribute, and if it's "display:block;", to set it to
> "display:none;"?
>
> Thanks!
>