By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,579 Members | 1,794 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,579 IT Pros & Developers. It's quick & easy.

About binding checkboxes and multiple row fields modification

P: n/a
Hi all.

I have a dataset with a datatable.
I have a form and a checkbox binded to a boolean field of my datatable.
When i check or uncheck my checkbox the binded row gets updated.

My problem is that when the checkbox is unchecked, apart from updating the corresponding binded field i need to modify another field in the same record.
I tried to use the CheckedChanged event of the checkbox but when i update the row in this event handler the checkbox never changes. (In fact this event is fired twice and the value of the binded field does not change). Here is my code:
this.checkBox1.DataBindings.Add(new Binding("Checked", this.dataSet11, "myTable.myBoolField"));

private void checkBox1_CheckedChanged(object sender, System.EventArgs e) {
CurrencyManager cm = (CurrencyManager)this.BindingContext[this.dataSet11,"myTable"];
DataRowView drv = (DataRowView)cm.Current;
DataRow dr = drv.Row;
dr["myTextField"] = "asdf";

If i comment the last line, the binded fields gets updated, but if i let it uncommented the binded field doesn't change.

Any hint?.

From: Albert Smith

Posted by a user from .NET 247 (

Nov 21 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.