View Single Post
Old 07-27-2008, 07:38 AM  
smack
Push Porn Like Weight.
 
smack's Avatar
 
Industry Role:
Join Date: Mar 2002
Location: Inside .NET
Posts: 10,652
one of my favorite CSS tricks is when using it in conjunction with ASP.NET to show/hide controls.

those of you who work with .NET know that if you set the visible property of a server control to false, it won't render to the browser at all, so you can't make it visible without using a postback.

so what i like to do is leave the visible property as true, but during the page load add a "display: none" CSS attribute to the control, then use a javascript to change that to "display: inline" on the client side so i can avoid at least one more trip back to the server.

makes the page much smoother since the show/hide is all done client side.
__________________
Cry havoc and let slip the dogs of war.
smack is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote