Group: Forum Members
Posts: 2K,
Visits: 6.6K
|
Lesscher,
Another approach would be to create a subclassed text box that alters the Text property and handles the Text property being empty when setting the underlying value. You'd leave the BO setup to return an alternate value for Null/Save Null on that alternate value (zero in this case). This makes any programmatic access to the data easier, as integers don't have NULL as a possibility.
I did this for the case of identities. If the ID is <0 (i.e. a new value), it displays "(new)", otherwise it displays the actual ID.
I overwrote the Text property. The setter just sets the Text property on the base class. The getter tests the value of the base class and simply displays something different if the number is negative.
I'd think you'd need to add some code to the setter, to set a "0" to the base class if the text is blank. And in the getter, you'd test for zero, displaying a blank in that case, otherwise whatever they have entered.
Hope that helps!
|