Revision: 32728
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at October 2, 2010 01:12 by mattvbiggs
Initial Code
<%@ Control Language="VB" Inherits="System.Web.Mvc.ViewUserControl" %> <% Dim Args() As String = ViewData("Args").ToString.Split(",") Dim SelectType As String = Args(0) Dim Label As String = Args(1) If SelectType = "Cascade" Then %> <input type="button" id="cascade" class="StandardButton" value="Cascade" /> <% Else%> <input type="button" id="selectall" class="StandardButton" value="Select All" /><br /> <% End If%> <input type="button" id="clear" class="StandardButton" value='<%= Label %>' /> <script type="text/javascript" language="javascript"> $(document).ready(function() { $('#selectall').click(function() { $("input[type='checkbox']:not([disabled='disabled'])").attr('checked', true); }); $('#clear').click(function() { $("input[type='checkbox']:not([disabled='disabled'])").attr('checked', false); }); $('#cascade').click(function() { $("div input[type='checkbox']").each(function() { if ($(this).attr('checked') == true) { $(this).siblings('div:eq(0)').find(':checkbox').attr('checked', true); } }); }); }); </script>
Initial URL
Initial Description
This code can be used to create a MVC View User Control (.ascx) that will display a cascade or select all button with a clear button for checkboxes arranged in a hierarchy.
Initial Title
JQuery: Select All / Clear / Cascade
Initial Tags
jquery
Initial Language
jQuery