.NETGURU
Issue binding a DateTimePicker to a DataView
Messages   Related Types
This message was discovered on microsoft.public.dotnet.framework.adonet.

Post a new message to this list...

Lorenz Kahl
Hi,

when I'm trying to bind a DateTimePicker to a DataView I receive a
System.Exception when the form loads.
I don't get an error when binding it to a DataSet.Table that is
representing exactly the same data.

The error-message is in German saying:
"DataBinding konnte keine Zeile in der Liste finden, die für alle
Bindungen verwendet werden kann."

I'll try to translate that:
"DataBinding wasn't able to find a row in the list, which could be used
for all bindungs."

Any ideas?
Thanks and regards,
Lorenz
Reply to this message...
 
    
Cor Ligthert
Lorenz,

The simples part to show to make it posible to help you is the binding code
and the creating of the dataview (or did you do it using the designer)?

Cor

....
[Original message clipped]

Reply to this message...
 
    
Lorenz Kahl
Hi Cor,

> (or did you do it using the designer)?

yes. Is that a problem?

When I use the DataSet.Table for DataBinding the generated code looks
like this:

this.dtpValidFrom.DataBindings.Add(new
System.Windows.Forms.Binding("Value", this.dsMemberDetails,
"Member.ValidFrom"));

When I use the DataView for DataBinding the generated code looks like
this but I gat the error:

this.dtpValidFrom.DataBindings.Add(new
System.Windows.Forms.Binding("Value", this.dvMemberFilter, "ValidFrom"));

That's exactly hoe I would have coded it by hand - so I don't get it,
why it fails...?
Reply to this message...
 
    
Lorenz Kahl
Lorenz Kahl wrote:

[Original message clipped]

OK,

I found a way to get it to work - though I don't understand why...
As Cor implied I bound the controls manually/programatically - NOT
graphically - in the 'Form'_Load-Handler, like so:

this.dtpValidFrom.DataBindings.Add("Value", this.dvMemberFilter,
"ValidFrom");

Don't know, why this is any different from the generated code???

Make sure that you 'unbound' the DateTimePicker-control graphically
before doing so.
Reply to this message...
 
    
Cor Ligthert
Lorenz,

And you did not add a rowfilter by accident in the designer in the dataview?

Cor

[Original message clipped]

Reply to this message...
 
    
Lorenz Kahl
Hi Cor,

[Original message clipped]

No! Not in the designer! But I do want to apply a row filter later
programatically! But there's no filter set, when the form loads!

Will the rowFilter interfer with the DateTimePicker? I wouldn't
understand the reason why...? Maybe you could shed some light for me?
Reply to this message...
 
 
System.Data.DataSet
System.Data.DataView
System.Exception
System.Web.UI.DataBinding
System.Windows.Forms.Binding
System.Windows.Forms.DateTimePicker




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification