Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem with saving Check Boxes
Message
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Divers
Thread ID:
00973959
Message ID:
00973963
Vues:
20
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform