Hi there,
Another databindings question concerning RadCheckBox. I've seen a few floating around, but for some reason I just cannot get it to work.
First, I create a bindingsource, a button and a checkbox in designer. On load I do the following in codebehind:
hasChanges returns always false. The other textboxes I have bound in similar fashion have no problems.
I use EF6 and the field 'active' is a bit column (which is seen as bool due to EF, therefore no parse/format). I also changed the threestate-property of the checkbox to false.
Any ideas as to how I can fix this?
Thanks in advance,
Jasper Gielen
Another databindings question concerning RadCheckBox. I've seen a few floating around, but for some reason I just cannot get it to work.
First, I create a bindingsource, a button and a checkbox in designer. On load I do the following in codebehind:
private
MyEntities dbContext =
new
MyEntities();
private
void
ManageClientsForm_Load(
object
sender, EventArgs e)
{
radCheckBox1.DataBindings.Add(
"IsChecked"
, bindingSource1,
"active"
);
Client c = (from c
in
dbContext.Clients
where c.Id = 1000
select c).First();
bindingSource1.DataSource = c;
}
private
void
radButton1_Click(
object
sender, EventArgs e)
{
if
(bindingSource1.DataSource ==
null
) {
return
; }
Client c = (Client)bindingSource1.DataSource;
bool
hasChanges = (from c
in
dbContext.ChangeTracker.Entries<Clients>()
where c.Entity == c & c.State != System.Data.Entity.EntityState.Unchanged
select c).Any();
if
(hasChanges)
{
dbContext.SaveChanges();
}
}
hasChanges returns always false. The other textboxes I have bound in similar fashion have no problems.
I use EF6 and the field 'active' is a bit column (which is seen as bool due to EF, therefore no parse/format). I also changed the threestate-property of the checkbox to false.
Any ideas as to how I can fix this?
Thanks in advance,
Jasper Gielen