RadCheckBox DataBindings problem

2 posts, 0 answers
  1. Jasper
    Jasper avatar
    4 posts
    Member since:
    Jul 2013

    Posted 10 Apr 2014 Link to this post

    Hi there,

    Another databindings question concerning RadCheckBox. I've seen a few floating around, but for some reason I just cannot get it to work.

    First, I create a bindingsource, a button and a checkbox in designer. On load I do the following in codebehind:

    private MyEntities dbContext = new MyEntities();
    private void ManageClientsForm_Load(object sender, EventArgs e)
        radCheckBox1.DataBindings.Add("IsChecked", bindingSource1, "active");
        Client c = (from c in dbContext.Clients
                    where c.Id = 1000
                    select c).First();
        bindingSource1.DataSource = c;
    private void radButton1_Click(object sender, EventArgs e)
        if (bindingSource1.DataSource == null) { return; }
        Client c = (Client)bindingSource1.DataSource;
        bool hasChanges = (from c in dbContext.ChangeTracker.Entries<Clients>()
                           where c.Entity == c & c.State != System.Data.Entity.EntityState.Unchanged
                           select c).Any();
        if (hasChanges)

    hasChanges returns always false. The other textboxes I have bound in similar fashion have no problems.

    I use EF6 and the field 'active' is a bit column (which is seen as bool due to EF, therefore no parse/format). I also changed the threestate-property of the checkbox to false.

    Any ideas as to how I can fix this?

    Thanks in advance,

    Jasper Gielen
  2. George
    George avatar
    500 posts

    Posted 15 Apr 2014 Link to this post

    Hi Jasper,

    Thank you for contacting us.

    Due to the specifics of the simple databinding in Windows Forms which was in conflict with our current implementation, we had to add a new property which can be used in this scenario. You will need to bind to the CheckState since it has the appropriate corresponding event CheckStateChanged. You will also need to use the Parse/Format events:
    Binding binding = new Binding("CheckState", bindingSource1, "Active", true, DataSourceUpdateMode.OnPropertyChanged);
    binding.Format += binding_Format;
    binding.Parse += binding_Parse;
    void binding_Format(object sender, ConvertEventArgs e)
        e.Value = (bool)e.Value ? CheckState.Checked : CheckState.Unchecked;
    void binding_Parse(object sender, ConvertEventArgs e)
        e.Value = ((CheckState)e.Value) == CheckState.Checked ? true : false;

    Let me know if you have further questions.


    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

  3. DevCraft R3 2016 release webinar banner
Back to Top