We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

How to check a CheckBox programmatically?

Thread ID:

Created:

Updated:

Platform:

Replies:

128959 Feb 17,2017 11:12 AM Feb 20,2017 08:03 AM ASP.NET MVC 1
loading
Tags: Checkbox
Cornel Amarandei
Asked On February 17, 2017 11:12 AM

Hi,

I have a CheckBox like this:

@Html.EJ().CheckBox("CheckBoxRefreshed").Checked(false).CssClass("hidden")

I want to check this CheckBox programmatically from the client side(so to change to true the Checked property).

Thanks,
Cornel.

sureshkumar.P [Syncfusion]
Replied On February 20, 2017 08:03 AM

Hi Cornel, 
 
Thanks for contacting Syncfusion support, 
 
You can dynamically change the property value from code behind by creating instance of  the control. To showcase this, here we have changed the CheckBox “checked” property(API) value programmatically using the toggleButton’s client side change event 
 
Please refer the below code sample 
var btnObj; 
        $(document).ready(function () { 
            btnObj = $("#CheckBoxRefreshed").data("ejCheckBox"); 
        }); 
function tglebtnChange(e) {  //toggleButton’s client side Change event 
        //checkbox object (instance) creation to access the checkbox propertyies 
        if (e.isChecked) 
            btnObj.option("checked", true);  // change the checked property as true by using checkbox object 
        else 
            btnObj.option("checked", false); // change the checked property as false by using checkbox object 
 
    } 
 
 
For your convenience, we have created a sample to change the CheckBox state’s by using ToggleButton’s client side event http://www.syncfusion.com/downloads/support/forum/128959/ze/CheckBox_ClientSideEvent-952065350  
To know more about checkbox API, Events and Methods using below link: https://help.syncfusion.com/api/js/ejcheckbox  
Regards, 
Sureshkumar P 
 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;