How to set asp Panel element visible/hidden with javascript/jquery -


i have asp:panel element on page. i'm able set visibility in code behind. need hide through javascipt.

my panel defined following:

     <asp:panel id="pnlupdatedisplay" runat="server" visible="false" style="width:500px; border-width: thick;">         <table style="width:300px;">             <tr>                 <td valign="middle" style="width:120px" align="center">                 <asp:label id="lblupdatemessage" runat="server" style="position:absolute; left: 120px; top: 120px;"></asp:label>                 </td>             </tr>         </table>           </asp:panel> 

when this:

   var panel = document.getelementbyid('pnlupdatedisplay');    panel.style.visibility = 'hidden';    panel.style.display='none'; 

there error saying: "error: unable value of property 'style': object null or undefined"

any suggestions?

if set visible="false" in .aspx markup / code behind, asp.net control not rendered in page.

better remove visible="false" set in panel , add style display:none.

if want make in code behind follow code

pnlupdatedisplay.style.add(htmltextwriterstyle.display,"none"); 

then use

$('#<%=pnlupdatedisplay.clientid %>').toggle() 

Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -