Hi, I'm having a problem with a datetimepicker and databinding.
I bind the text of the picker to a value from the database and it works perfectly fine and shows the value correctly, however whenever i change the text in the datetimepicker field to update, it changes, BUT gets back again to its original value when i advance to another textfield or any other control on the form.

anyone has an idea why this is happening?

Do perform an update on database too as the datetime picker is bound with database or you can also remove the databinding on value change event of datetime picker

commented: Agree +2

I think you should use some advance data bindg methods.

//Build a header with columns
grid.Headers.Add(new Header());
grid.Headers[0].Add(new Column("IntValue"));
grid.Headers[0].Add(new Column("DoubleValue"));
grid.Headers[0].Add(new Column("StringValue"));

//Add data object at the top-level and attach 2 children of the same type
Row row1 = grid.Rows.Add(new MyCustomClass(10, 11.11, "item 1"));
row1.Add(new MyCustomClass(11, 11.22, "subitem 1"));
row1.Add(new MyCustomClass(12, 11.22, "subitem 2"));

//Add data other data object with 2 children
Row row2 = grid.Rows.Add(new MyCustomClass(20, 22.11, "item 2"));
row2.Add(new MyCustomClass(22, 22.22, "subitem 1"));
row2.Add(new MyCustomClass(22, 22.22, "subitem 2"));

If you seriously need please visit here for advance data binding tutorial

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.