Search code examples
asp.netcheckboxwebformscolorbox

Checkbox is always false when using colorbox


Although there was no gridview or any other databound control, my checkbox value was always false. I was using colorbox btw. I checked both chrome's debugger (post collection) and Request.Form collection, these controls weren't posted.


Solution

  • The problem was; colorbox's divs were places out of the form tag, so that their values was not being posted. When i appended these divs to form, the problem was solved:

        $(document).bind('cbox_complete', function () {
            $("#colorbox, #cboxOverlay").appendTo('form:first');
        });
    

    By design, browsers send contents inside form tag, so that they were not being posted back...