Click here to Skip to main content
15,895,011 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have master page and some content pages. In master page I have a Jquery to make Panel to visible. It works when I am at master page. After moving to content page and on click of any button for another page an exception is thrown atating "The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>)." How to rectify this?
My code in master page:
XML
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>
    $(document).ready(function() {
      $('#<%=Panel1.ClientID%>').hide();
      $('#<%=PnlPrasiddhiShortEats.ClientID%>').hide();

        $('#<%=Button5.ClientID%>').mouseout(function() {
        $('#<%=Panel1.ClientID%>').hide();
        });

        $('#<%=Button5.ClientID%>').mouseover(function() {
        $('#<%=Panel1.ClientID%>').show();
    });

 $('#<%=Button6.ClientID%>').mouseout(function() {
    $('#<%=PnlPrasiddhiShortEats.ClientID%>').hide();
    });

    $('#<%=Button6.ClientID%>').mouseover(function() {
    $('#<%=PnlPrasiddhiShortEats.ClientID%>').show();
    });

    });
</script>
Posted
Comments
Try with <%# ID %> instead of <%= ID %>.
S.Rajendran from Coimbatore 21-Mar-14 5:06am    
I changed like <%# ID %> but no effect. The Jquery itself is not working. The first two controls to be hidden is displaying whereas in previous one it worked well.

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