Click here to Skip to main content
13,453,456 members (42,442 online)
Click here to Skip to main content
Add your own
alternative version


7 bookmarked
Posted 5 Feb 2012

Show/hide elements dynamically in web page

, 6 Feb 2012
Rate this:
Please Sign up or sign in to vote.
Show/hide elements dynamically in web page


How to Show/hide elements dynamically in web page via Server-side/client-side. Let's take a DIV for example:


<div id="Div1"  runat="server">

//To show
Div1.Visible = true;
//To hide
Div1.Visible = false;

Client-side - JavaScript

Using Visibility property
div = document.getElementById('<%=Div1.ClientID%>')
//To show"visible";
//To hide"hidden";

Using display property:
div = document.getElementById('<%=Div1.ClientID%>')
//To show"block";
//To hide"none";

Client-side - jQuery
//To show
//To hide

Further Reading


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Web Developer
India India
Retired from Q/A section & Technical forums since 2014

More coming soon....

You may also be interested in...

Comments and Discussions

Questionusing server side method, the hidden div won't show up Pin
t4nu17-Dec-14 13:39
membert4nu17-Dec-14 13:39 
AnswerRe: using server side method, the hidden div won't show up Pin
thatraja18-Dec-14 14:37
protectorthatraja18-Dec-14 14:37 
QuestionHide elements Pin
Member 104863646-Sep-14 18:58
memberMember 104863646-Sep-14 18:58 
AnswerRe: Hide elements Pin
thatraja11-Sep-14 2:17
protectorthatraja11-Sep-14 2:17 
QuestionClient side without reload the page? Pin
Igor Maozao9-Feb-13 3:34
memberIgor Maozao9-Feb-13 3:34 
GeneralHow about ClientID for server div? Maybe you miss something?... Pin
Anton Levshunov6-Feb-12 10:26
memberAnton Levshunov6-Feb-12 10:26 
GeneralRe: Yep, I forgot to include the ClientIDs. Now I have updated t... Pin
thatraja6-Feb-12 19:47
mvpthatraja6-Feb-12 19:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.180318.3 | Last Updated 7 Feb 2012
Article Copyright 2012 by thatraja
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid