Skip to content Skip to sidebar Skip to footer

DataBindings On A Checkbox

I am currently pulling data from one of my SQL Databases into my application. I can get it working for my text boxes and other items, however, I can not seem to get it to work for

Solution 1:

Try

Check.DataBindings.Add("Checked", dt, "check");

The first parameter is the property of the control, so instead of "Text", you want "Checked".


Solution 2:

Try

Check.DataBindings.Add("Checked", dt, "check");

The first parameter is the property of the control, so instead of "Text", you want "Checked".

This is correct. But the one thing you need to know (which took me half an hour just now), the checkbox needs to validate (with the default setting). So it needs to lose focus for example.

So I found the better solution would be:

Check.DataBindings.Add("Checked", dt, "check", false, DataSourceUpdateMode.OnPropertyChanged);

Post a Comment for "DataBindings On A Checkbox"