Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem with saving Check Boxes
Message
General information
Forum:
ASP.NET
Category:
Forms
Miscellaneous
Thread ID:
00973959
Message ID:
00973963
Views:
21
Hey, Gerard,

You need to do a couple of things...

First, you need to bind to the Checked property of the checkbox, like so...
System.Windows.Forms.Binding chkBinding;
chkBinding = new System.Windows.Forms.Binding("Checked",
				MyDataSet  , "MyTable.MyFlag");

chkBinding.Format += new ConvertEventHandler(this.CheckBoxHandler);
chkEmployee.DataBindings.Add(chkBinding);
Note the reference to "CheckBoxHandler"...it's there to handle null values...
private void CheckBoxHandler(object sender, ConvertEventArgs e)
{
    if (e.Value == DBNull.Value)
     e.Value = false;
}
Let me know if that helps...
Kevin
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform