Click here to Skip to main content
15,894,343 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to show the display:none in javascript in asp.net.I have a panel and i put it in the display:none .When a click a image the panel will be shown how?

What I have tried:

I tried ('#').Show();
document.elementid('#').style.display='block';

I tried this two method but the panel is not shown the records
Posted
Updated 9-Jan-17 22:15pm
Comments
F-ES Sitecore 10-Jan-17 6:24am    
There is no such function as document.elementid. Google "show hide div javascript" and you'll find the right code, also ensure you are using the right ID in your code as asp.net changes the html id of a component so it won't necessarily match the server-side id, use ClientID to get the right id, again google for examples.

1 solution

using javascript, to hide an object you can do like-
JavaScript
object.style.visibility = "hidden";

and to make it visible you can do like-
JavaScript
object.style.visibility = "visible";

Example:
JavaScript
$("#Id").style.visibility = "hidden";


Or, if you like to use JQuery, to hide-
JavaScript
$("#Id").hide();

to show-
JavaScript
$("#Id").show();


However, the problem also is you haven't mentioned the id of the panel while doing this.

Hope, it helps :)
 
Share this answer
 
Comments
Member 12857356 10-Jan-17 5:20am    
i will try this method .But the panel is not shown

This is my code:

$(function () {
$("[src*=photo]").live("click", function () {
debugger;
alert("hi");
var panel = document.getElementById(".pnlgrd");

panel.style.display = "block";
Suvendu Shekhar Giri 10-Jan-17 5:27am    
What do you expect from following line?
if (panel)
Member 12857356 10-Jan-17 5:30am    
Sry ....Wrongly Enter the code..Now u check ? pleas
Member 12857356 10-Jan-17 5:57am    
In this i have a gridview .Inside the gridview i put the panel and datalist controls.The datalist contain datas.So i put the panel as display:none.In the Gridview i have an Image ,So when we click a image the panel will shown..this is my issue..

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900