View Full Version : Binding null values
abstraction
04-25-2007, 05:17 PM
I'm trying to use the BindingManager to bind a null value to a decimal? property. Is this currently possible or do I need write a TypeConverter?
For reference here's the error I get when attempting to bind the null value to a decimal?.
Cannot convert property value of type [null] to required type [System.Nullable`1[[System.Decimal, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]] for property 'MyDecimalProperty'.
Erich Eichinger
04-25-2007, 08:59 PM
Hi,
are you using the latest nightly build? There's a JIRA issue SPRNET-408 (http://opensource.atlassian.com/projects/spring/browse/SPRNET-408) about this problem but it says it is already resolved.
cheers,
Erich
abstraction
04-25-2007, 09:18 PM
I'm using the Spring.Data.NHibernate12-20070412-0201.zip, which is the latest Spring.Data.NHibernate12 build. Is this build sufficient?
Erich Eichinger
04-25-2007, 09:38 PM
Hi,
could you plz post your configuration + code snippets?
-Erich
abstraction
04-25-2007, 09:46 PM
I believe these are the relevant bits. Let me know if you need anything else.
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
namespace My.Model
{
[Serializable]
public class Application
{
private decimal? credits;
public virtual decimal? Credits
{
get { return credits; }
set { credits = value; }
}
}
}
protected override void InitializeDataBindings()
{
BindingManager.AddBinding("credits.Text", "application.Credits");
}
Mark Pollack
04-30-2007, 05:29 PM
Erich added SPRNET-538 (http://opensource.atlassian.com/projects/spring/browse/SPRNET-538) to JIRA to keep track of this issue.
vBulletin® v3.7.3, Copyright ©2000-2009, Jelsoft Enterprises Ltd.