Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Binding Checkbox to nchar column
Message
 
 
À
31/01/2010 14:25:27
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Versions des environnements
Environment:
C# 2.0
Divers
Thread ID:
01445996
Message ID:
01446763
Vues:
14
For once instead of asking you a question I will share with you something I found. I know now why when I was binding the check box using the syntax
this.chkStatus.DataBindings.Add("Checked", bindingSource1, "VendorStatus");
things would not work when moving in the grid to the new row. Or when creating a new row in code in my AddNew button. I am sure you already know that but the reason is that my column VendorStatus allows NULLs and when a new row is added in the grid the value set to the check box is NULL. And method DataBindings.Add has a problem with NULLs. I suppose this is why you created your own method DataBind(). So my solution will be NOT to allow user to add a new row while browsing the grid (I have not checked it but hopefully this property/setting exist). Then in my Add New button when adding a new row to the table I will set the value of the Check Box Column to 1. I just tested it and it works. Or better, I will change my database design not to allow NULLs and see if this setting will work too. But the good news is that I don't have to create a bunch of methods BindData in my subclasses. You see every time I create some code - since I am still learning a lot - I am bound (no pun intended) to make a mistake.

I am sure I will be back with more questions as on every step of my development I am hitting a wall (my head hurts <g>).

Thank you.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform