Thursday, April 18, 2013

JQuery for a select all checkbox

So I have a asp.net repeater with a bunch of check boxes.  I want to have a select all/unselect all checckbox at the top of the repeater.

I used this little snippet of jquery to do it.

I got this great script from the bottom of a stack overflow post Here is a small revision on this, when doing this in asp.net with an ajax update panel you need to add the live. This way when the update panel refeshed the html, you can re-connect to your event.

Thursday, April 11, 2013

asp.net Update Panel and hiding elements

When working on a asp.net application that was using multiple update panels I was getting an error something like


Could not find UpdatePanel with ID 'xxx'. If it is being updated dynamically then it must be inside another UpdatePanel

I found the post below on stack overflow.


Basically my issue was that I was hiding the <asp:Panel> that contained the update panel.  This does not work at all.  You cannot do

<asp:panel visible="false" runat="server">
     <asp:UpdatePanel runat="server">
          <ContentTemplate>
                    <div>some stuff</div>
         </ContentTemplate>
    </asp:UpdatePanel>
</asp:panel>

Once I removed the visible="false" from the <asp:Panel> that my <asp:UpdatePanel> and everything worked like a charm.