[Solved] 50000 checkboxes in aspx/html too heavy -any alternative?


If you’re trying to select the checkboxes using code in your code behind, that’s going to be slow because it’s a back-end solution for what should happen in the front-end. Even if you set up pagination so you display only 50 checkboxes at a time, it’ll still be slow if you’re doing the checking in the code behind. To select checkboxes with jQuery, which is a much faster solution, try something like this:

$(document).ready(function () {
    $('#body').on('click', 'input[type=submit]#uxSelectAll', function () {
        $(this).toggleClass("checked");
        var isChecked = $(this).hasClass("checked");
        $('input[type=submit]#uxSelectAll').val(isChecked ? "Unselect All" :  "Select All");
        $(this).prev().find(":checkbox").prop("checked", isChecked);
        return false;
    });
});

Here you have a Select All button that checks and unchecks the checkboxes on click. You can select the checkboxes with a selector like this:

$(this).find(":checkbox").prop("checked", true);

Note: This question assumes that you’re using as your checkboxes.

solved 50000 checkboxes in aspx/html too heavy -any alternative?