I'm trying to set the checked property of checkboxes with jQuery, the jQuery code is working fine, but I got the problem in codebehind:
particular.click(function () { company.removeAttr('checked'); particular.attr('checked', 'true'); }); Company and particular are the names of checkboxes, the jQuery code is working fine, my problem is in codebehind (.cs file)
if (particular.Checked) { company_name_blank.EnableClientScript = false; cif_blank.EnableClientScript = false; } This is not working because Checked property is set on false when actually I'm setting it on true as you can see in the jQuery code, so where is the mistake?? For more explanation, I'm trying to disable some RequiredFieldValidators depending on which checkbox is checked, but as I told, Checked property is always set on false unless I set it on true by default in the element Checked=true, or particular.Checked=true in codebehind file, but that is not what I want to. I want to set on true the Checked property when I click the checkbox that's why I used jQuery.
UPDATE
My code
protected void Page_Load(object sender, EventArgs e) { if (particular.Checked) { company_name_blank.EnableClientScript = false; cif_blank.EnableClientScript = false; contact_name_blank.EnableClientScript = false; contact_cognames_blank.EnableClientScript = false; } }