Managed field, Nullable causing values to disappear
Managed field, Nullable causing values to disappearOld forum URL: forums.lhotka.net/forums/t/6545.aspx
cash_pat posted on Tuesday, March 03, 2009Hi all,
I am stuck up deep in a fairly simple problem. Hope someone can help me out.
I have some textboxes bound to nullable decimals, ints etc. The problem is whenever i change a value in these controls and tab out they are reset to the previous values. I dont know what is happening. any ideas.
RockfordLhotka replied on Tuesday, March 03, 2009
Does the object property's setter get called (use the debugger to find out)?
If not, and I suspect not, then you have an issue at the UI level where data binding isn't handling this properly, and you probably need to tweak some settings on the textbox controls to tell them to support null values.
If the value does get to the setter, is the setter somehow throwing an exception? That may also cause odd behaviors - set blocks shouldn't throw exceptions, and if it is throwing then there's a bug somewhere (possibly in one of your validation rules).
cash_pat replied on Tuesday, March 03, 2009The Setter is not being called. Also, i am binding it to a plain textbox control.
I am not aware of any properties on the windows textbox which need to be tweaked
RockfordLhotka replied on Tuesday, March 03, 2009It has been a while since I looked at this sort of thing, but I think there
are properties on the textbox control dealing with how it handles null
From: cash_pat [mailto:email@example.com]
Sent: Tuesday, March 03, 2009 10:35 AM
Subject: Re: [CSLA .NET] Managed field, Nullable causing values to disappear
The Setter is not being called. Also, i am binding it to a plain textbox
I am not aware of any properties on the windows textbox which need to be
cash_pat replied on Tuesday, March 03, 2009Also, as i soon as i change my code to
Private Shared MinimumStockProperty As PropertyInfo(Of Integer) = RegisterProperty(GetType(InventoryItem), New PropertyInfo(Of Integer)("MinimumStock", "Minimum Stock", Nothing))
Public Property MinimumStock() As Integer
Return GetProperty(Of Integer)(MinimumStockProperty)
Set(ByVal Value As Integer)
SetProperty(Of Integer)(MinimumStockProperty, Value)
it starts working !!
Copyright (c) Marimer LLC