Welcome Guest Search | Active Topics | Sign In | Register

Masked Edit Controls and Null values. Options
SDDP
Posted: Wednesday, February 10, 2010 4:57:20 PM
Rank: Member
Groups: Member

Joined: 3/16/2009
Posts: 23
I am using the masked edit control for phone numbers and it works well. The problem I have is when the customer wants a new field on their form. I add the new phone number field to the database and the web form. This is all that is needed for creating new records. But when they try to edit an existing record, I get an exception from the edit control. I have to go in and update the new field to '( ) - ' so existing records don't have Null values.

Is there some way to get the masked edit control to handle Null values when being bound from the database? If not, I would really recommend that as a feature. Regular text boxes can be bound to a Null value and they don't complain.

Code: HTML/ASPX
<eo:MaskedEdit ID="PhoneNumberTextBox" runat="server" Text='<%# Bind("PhoneNumber") %>'
                                    Font-Names="Arial, Helvetica, sans-serif"><eo:MaskedEditSegment Text="(" IsRequired="True" /><eo:MaskedEditSegment Mask="000) 000-0000" SegmentType="Mask" IsRequired="True" /></eo:MaskedEdit>
eo_support
Posted: Thursday, February 11, 2010 9:08:10 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

Unfortunately there is no way except for pre-formatting the data before you give it to the MaskedEdit. The MaskedEdit will only try to strictly match whatever you give it to with its masks. It does not try to automatically add separators (such as "()-" in your case. So you can change your binding expression to a function that does the formatting. That way you do not have to update your database.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.