Thursday, August 25, 2016

Sending arrays to SQL Server: Xml vs. Comma Separated Values

sending-arrays-to-sql-server-xml-vs-comma-separated-values

Check or Uncheck all CheckBoxes in an ASP.NET GridView using jQuery





var $headerCheckBox = $('.headerSelectAll input[type="checkbox"]');
        var $childCheckBox = $('.childSelect input[type="checkbox"]');
        $($headerCheckBox).change(function () {
            $childCheckBox.each(function () {
                this.checked = $headerCheckBox[0].checked;
            })
        });

        $($childCheckBox).change(function () {
            // if any of the checkbox is unchecked
            // check all checkbox should be cleared
            if (!$(this).is(':checked')) {
                $headerCheckBox.removeAttr('checked');
            }
            else {
                // if all of the checkbox is checked
                // check all checkbox should be checked
                if ($childCheckBox.length == $childCheckBox.filter(':checked').length) {
                    $headerCheckBox[0].checked = true;
                }
            }
        });