468,267 Members | 1,841 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,267 developers. It's quick & easy.

DataBinding change notification problem...

Hi,

I have a DateTime picker control on a form. The datetime
picker control is data bound to a column in a DataTable.
Yes I know about bound DateTime pickers and DBNull and
etc. so no troubles with that stuff...

However, as somebody out there probably knows,
programmatically setting the DateTimePicker.Value property
to a new VALUE does NOT in itself constitute a CHANGE to
the DataBinding mechanism {control focus etc. are involved
in the decision to fire change notification}.

Well this is causing me grief! I have a situation where I
MUST programmatically change the DateTimePicker.Value
property and I need the change to ripple down to my
DataRow immediately.

Question: How can I FORCE DataBinding change events to
fire for one or more bound controls on my form?

--Richard
Nov 15 '05 #1
2 3576
Richard:

Just a suggestion: you could try to take it the other way. Instead of
trying to programmatically modify the value of the datetime picker and have
it ripple down to the datarow, you could modify the underlying data field,
and let it "ripple up" to the control.

The trick would be getting to the current row. I think that it would go
something like this (haven't tested, this code might need some adjustment or
syntax correction):

// get the databinding object for the value property
Binding theBinding = theDateTimePicker.DataBindings["Value"];

// Get the current row
// if the target is a data row, I _think_ that you are going to get back a
// DataRowView object, but I might be lying.
DataRowView rowView = (DataRowView)theBinding.BindingManagerBase.Current ;

// modify the value
rowView["TheColumnName"] = ANewDateTimeValue;


"Richard" <an*******@discussions.microsoft.com> wrote in message
news:ef****************************@phx.gbl...
Hi,

I have a DateTime picker control on a form. The datetime
picker control is data bound to a column in a DataTable.
Yes I know about bound DateTime pickers and DBNull and
etc. so no troubles with that stuff...

However, as somebody out there probably knows,
programmatically setting the DateTimePicker.Value property
to a new VALUE does NOT in itself constitute a CHANGE to
the DataBinding mechanism {control focus etc. are involved
in the decision to fire change notification}.

Well this is causing me grief! I have a situation where I
MUST programmatically change the DateTimePicker.Value
property and I need the change to ripple down to my
DataRow immediately.

Question: How can I FORCE DataBinding change events to
fire for one or more bound controls on my form?

--Richard

Nov 15 '05 #2
Hello,

I'm having difficulties with the same problem in combination with the
DBNull issue. Can you explain the following a bit more, please? Do you
even have a solution for the DBNull-problem that works with databinding?
However, as somebody out there probably knows,
programmatically setting the DateTimePicker.Value property
to a new VALUE does NOT in itself constitute a CHANGE to
the DataBinding mechanism {control focus etc. are involved
in the decision to fire change notification}.


thanks in advance
Frank

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 15 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

15 posts views Thread by Tim Jarvis | last post: by
3 posts views Thread by Kevin Swanson | last post: by
11 posts views Thread by John J. Hughes II | last post: by
7 posts views Thread by Vlado Jasovic | last post: by
3 posts views Thread by Mauro D. | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by zattat | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.