Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

Javascript to toggle visibilty of panels

$
0
0

Hello, still kind of new to Javascript,

I got some javascript off the internet (thanks Arvind), but I can't seem to get it to work for my purposes.

Bascially I have some linkbuttons (I guess this is the proper control to use for what I would like accomplished) in a left column. 

When the button is clicked I would like it's associated panel in the content area to toggle visibile or invisible.

First question, since I am using a masterpage, where should the javascript be located? In the masterpage or on the child page?

Running this produces the error stating: 'toggle_visibility' is not a member of the aspx page.

Here is the code:

<asp:Content ID="Content1" ContentPlaceHolderID="MenuContentPlaceHolder" Runat="Server"><asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></asp:ToolkitScriptManager><script type="text/javascript">

    function toggle_visibility(id) {
       var e = document.getElementById(id);
       if(e.style.display == 'block')
          e.style.display = 'none';
       else
          e.style.display = 'block';
    }

</script><div id="LColumn"><h4>Select Graph Displays</h4><asp:LinkButton ID="lnkCurWklyAvgWageFTE" onclick="toggle_visibility('Panel_CWAWFTE');" runat="server" > Current</asp:LinkButton></div><div id="RContent"><table><tr><td><asp:Panel ID="Panel_CWAWFTE" runat="server"  style="display:none;" > Hey 1 </asp:Panel></td></tr></table></div>

Can you help? Thanks


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>