Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DataBinding a CheckBox
Message
From
24/10/2002 18:00:02
 
 
To
All
General information
Forum:
ASP.NET
Category:
Forms
Title:
DataBinding a CheckBox
Miscellaneous
Thread ID:
00715187
Message ID:
00715187
Views:
44
Hi all,

Sorry I haven't been answering many questions here lately ... I've been head-down in coding 24/7. <g> But I have a question that hopefully someone else will be able to answer.

I have a control with a checkbox on it that I would like to bind to a boolean column in a DataSet. The DataSet is filled from a SQL Server table and it *does* allow NULLs in the column.

I can't bind to the CheckState (blows up with an error about "Invalid cast from System.Boolean to System.Windows.Forms.CheckState"), so I'm binding to Checked (which seems right to me anyway). I've set the CheckBox.ThreeState = true (since the column *can* have a NULL value).

I seem to be getting a problem though when I attempt to change the BindingContext.Position to a row that has a DBNull.Value in this column. I get no error that I can see, but the BindingContext.Postion just doesn't change ... it remains on whatever row it was already on rather than go to the row with the null value.

What's up with that? Anyone know of a work-around or am I just doing things wrong?? (BTW, this behavior happens whether I have ThreeState either true or false).

TIA,
~~Bonnie
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Next
Reply
Map
View

Click here to load this message in the networking platform