Toggel visibility of Div tag in easy way

usually most developers use J Query/CSS to toggle the visibility of webpage elements. for example a DIV tag, however even it is not visible in a webpage, if you examine the source code you will be able to see the div tag in source code. because it is already being rendered by server. however in we can use following code to do the same trick.

Page.FindControl("YourDivId").Visible = false;

Advantage of using this way is,

  • Easy to use.
  • Server do not render the div tag. completely invisible, even to java script web crawlers
  • Most of all its pure .Net. no need to write too many lines of code. simple yet powerful

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.