Using a System.Int32 and null values


Author
Message
Lesscher
Lesscher
StrataFrame Beginner (13 reputation)StrataFrame Beginner (13 reputation)StrataFrame Beginner (13 reputation)StrataFrame Beginner (13 reputation)StrataFrame Beginner (13 reputation)StrataFrame Beginner (13 reputation)StrataFrame Beginner (13 reputation)StrataFrame Beginner (13 reputation)StrataFrame Beginner (13 reputation)
Group: StrataFrame Users
Posts: 9, Visits: 19
Hi all,

I have several fields in my table of type System.Int32 and they are allowed to be null. I want to put a NULL value (not a 0) in the database table when the user empties a textbox (bound to the BO).

I already read the posts about this solution using String.Empty but thats not working for me... Also, I tried to use nullable generics in the datamapper but then, when the user empties the textbox, the new (empty) value isn't saved to the BO (the old value remains)

This can't be that difficult, am I right?

Reply
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
Instead of overriding the KeyUp, inherit the SF textbox and override the ProcessCmdKey method.  This will give you 100% control on the input before the value is actually changed.  You can also override the Text property (or whichever property to which you are binding) and provide additional logic in the Set/Get which will then give you 100% control on the input as well as the values coming and going from the control.  If you replace the logic in these two locations that should be everyplace that you need in order to change the underlying logic to meet your needs.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search