AJAX :: MaskedEditExtender - Using Mask With Number With Decimal Get The Wrong Initial Bind Value

Apr 26, 2010

I have confronted a problem of using MaskedEditExtender when try to restrict user to input a number mask with mask. User input of course has no problem. The problem is when the system get the value from database or somewhere (doing assignation), the textbox show the wrong value with the following mask setting: I am writing to contribute and share my solution: example:

textbox1: 1.1 (user input) by using the following mask:
<asp:MaskedEditExtender ID="meeXML" runat="server"
TargetControlID="textbox1"
Mask="999.99"
MessageValidatorTip="true"
OnFocusCssClass="MaskedEditFocus"
OnInvalidCssClass="MaskedEditError"
MaskType="Number"
InputDirection="RightToLeft"
AcceptNegative="Left"
ClearMaskOnLostFocus="True"
ErrorTooltipEnabled="True"/>
When the system get back the data, textbox1 will show:
textbox1: 0.11 <- that is not the actual what I want:
==========================================
the solution:
==========================================
<asp:MaskedEditExtender ID="meeXML" runat="server"
TargetControlID="textbox1"
Mask="NNNNNNNNNNNN"
MessageValidatorTip="true"
OnFocusCssClass="MaskedEditFocus"
OnInvalidCssClass="MaskedEditError"
MaskType="Number"
InputDirection="RightToLeft"
AcceptNegative="Left"
ClearMaskOnLostFocus="True"
Filtered="."
ErrorTooltipEnabled="True"/>

View 1 Replies


Similar Messages:

AJAX :: Phone Number Mask Format With MaskedEditExtender

Feb 21, 2011

I want a TextBox with a mask like (xxx) xxx-xxxx using a MaskedEditExtender. I tried to set up the mask property to "(999) 999-9999" or "(999) 999-9999" but nothing works. It there a way I can have the mask I want?

View 2 Replies

AJAX :: MaskedEditExtender Phone Dashes In Mask

Feb 11, 2010

I just started using the mask control. I have it working exactly the way I want with date but can't get the same behavior with Phone.

<AjaxControlToolkit:MaskedEditExtender
ID="mskTbTicketOpenedDate"
runat="server"
TargetControlID="tbTicketOpenedDate"
Mask="99/99/9999"
MessageValidatorTip="true"
OnFocusCssClass="MaskedEditFocus"
OnInvalidCssClass="MaskedEditError"
MaskType="Date"
ErrorTooltipEnabled="True" />

Date Mask Validator:

<asp:RequiredFieldValidator
ID="rfValTbTicketOpenedDate"
runat="server"
ControlToValidate="tbTicketOpenedDate"
Display="Dynamic"
ErrorMessage="required!<br />" />
<AjaxControlToolkit:MaskedEditValidator
ID="mskValTbTicketOpenedDateInvalid"
runat="server"
ControlExtender="mskTbTicketOpenedDate"
ControlToValidate="tbTicketOpenedDate"
IsValidEmpty="false"
InvalidValueMessage="Date is invalid<br />"
Display="Dynamic" />

Breaking out the required field validation helped me get the date textbox to behave the way I need. Just positioning validation messages and such. Behavior I like here is that TextBox has no mask to start (focus off of textbox). When you put the cursor in the textbox or the textbox gets focus then the mask shows up: __/__/____. As you type the underscore placeholders dissapear but the '/' chars stay in place.

And finally, this is key, when you have a correct date and take the focus away from the text box the dashes stay in place. I just realized that is because the date mask seems to fill in the blank spaces with the current date. I cannot get this behavior with a phone. Granted there is no phone mask type. Here is the phone code:

<AjaxControlToolkit:MaskedEditExtender
ID="mskTbPhone"
runat="server"
TargetControlID="tbPhone"
Mask="999-999-9999"
ClearMaskOnLostFocus="true"
MessageValidatorTip="true"
OnFocusCssClass="MaskedEditFocus"
OnInvalidCssClass="MaskedEditError"
MaskType="None"
ErrorTooltipEnabled="True" />

I have tried MaskType set to number but it doesn't change the behavior. Right now the dashes dissapear when I take the focus off of the phone textbox. One thing I noticed with date is that if it is incomplete when it loses focus it fills in the rest with the current date values. Since there is no Phone mask type that behavior is not built in. Does anyone know how to set a default behavior so if you type in 55 in would automatically finish? 555-55-5555 And when you take the focus off it would keep the dashes. But if the textbox is empty I want with no focus the mask should dissapear completely.

View 3 Replies

AJAX :: MaskedEditExtender Mask Not Showing On TextBox

Sep 26, 2013

I am using the AJAX Toolkit MaskedEditExtender to format some of my web form's textboxes.  When I load the page and start to enter data into the textboxes, the masking doesn't show. I've included my page code below:

<asp:TextBox ID="GrantExpendituresAmount" runat="server" Text='<%# Bind("GrantExpendituresAmount") %>'
Width="450px"></asp:TextBox>
<ajax:MaskedEditExtender ID="GrantExpendituresAmount_MaskedEditExtender"
runat="server" CultureAMPMPlaceholder="" CultureCurrencySymbolPlaceholder=""
CultureDateFormat="" CultureDatePlaceholder="" CultureDecimalPlaceholder=""
CultureThousandsPlaceholder="" CultureTimePlaceholder="" Enabled="True"
Mask="$999,999,999.00" TargetControlID="GrantExpendituresAmount">
</ajax:MaskedEditExtender>

View 1 Replies

AJAX :: Changing Mask Value For MaskedEditExtender Using Java Script

Feb 27, 2010

using java script with update panel. I have checkbox, textbox with MaskedEditExtender inside update panel in web content form. I want to change the mask for MaskedEditExtender when I check the checkbox without doing pastback for the update panel using java script

[Code]....

View 2 Replies

AJAX :: MaskedEditExtender Mask Not Working Properly After Turning Off Readonly

Sep 24, 2010

I ran into a strange issue with the AJAX MaskedEditExtender control, the extender is used with the Mask="99/99/9999" and MaskType="Date". Initially when the page loads the textbox was set to readonly using textbox.Attributes.Add("readonly", "readonly") in the codebehind. After the page loads if the user clicks on a certain button it would change the textbox to editable using javascript code: textbox.readOnly = false. The strange thing is after that if you start typing in the textbox you can see the entire mask
(__/__/____) shifting to the right as you type. For example it looks something like this: 09__/__/____ instead of the normal 09/__/____.

If the textbox was never set to readonly in the first place this behavior won't happen. So it seems something got messed up when changing from readonly to not. I was able to reproduce this in a barebone aspx page with just the textbox, the mask extender, and a button that when clicked turning off the textbox's readonly. Anyone knows how I can fix this?

I'm using Ajax toolkit v3.0.30512

View 5 Replies

AJAX :: Reach The Mask Property From The MaskedEditExtender Control In The Client Side Script?

Jan 18, 2010

How do I reach the mask property from the MaskedEditExtender control in the client side javascript?

[Code]....

View 4 Replies

AJAX :: Mask Edit Extender With Decimal Value?

Feb 11, 2011

I have the following mask edit extender:

<asp:MaskedEditExtender
ID="txtVersion_MaskedEditExtender"
runat="server"
Enabled="True"
Mask="99.99"
MaskType="Number"
TargetControlID="txtVersion">
</asp:MaskedEditExtender>

It allows to type only decimal values, like 15.15. But when I save its value into a decimal variable the format chages to 1515.

Dim Version As Decimal
Version = CDec(txtVersion.Text)

View 5 Replies

AJAX :: MaskedEditExtender Decimal Values?

May 10, 2010

I am using MaskedEditExtender on my textbox.Set the masktype to number.Now the user can enter decimals also at any place to my textbox.Is it possible for my MaskedEditExtender to still accept that or I have to use custom javascript/ regex for this.

View 5 Replies

AJAX :: MaskedEditExtender Forcing User To Enter Decimal Point?

Oct 14, 2010

I have a MaskedEditExtender set for a TextBox that will receive a fee amount. I want the user to be able to type the "." decimal when the amount contains a decimal value (123.45). But if the amount has not decimals (123) I want the mask to automatically fill the 2 decimal with zeroes and also enter the "." decimal point (123.00).With the following mask I'm able to enter a full number (999) and get the zeroes but when user enters 85.85 it will be 850.85 so I change the direction RightToLeft but I'm not even able to type the first character.

<cc1:MaskedEditExtender ID="txtFee1ME" runat="server" PromptCharacter=" " Mask="999.99"

View 2 Replies

AJAX :: MaskedEditExtender's - Mask Characters Don't Hide Under Typing Characters

Feb 1, 2010

I have a problem with MaskedEdit's mask for the code shown below:

[Code]....

When I'm starting to print date in the TextBox, mask moves with characters. Mask characters don't hide under typing characters.

View 7 Replies

AJAX :: Error "Invalid Home Number. Number Should Be In The Format: 555-123-4567" With MaskedEditExtender

Oct 28, 2010

My requirement is, I have one text box and that text box accepts US Format 10 digit phone number like 555-555-5555. I want when user enter 5555555555 it automatically convert this in 555-555-5555 and if he enter some wrong number then show him error and if dont want to enter any thing then there should not be any error.

<th style="width: 150px">Home Telephone </th>
<td>
<asp:TextBox ID="txtHome" runat="server" MaxLength="12" ValidationGroup="vUserDetailsB" Width="252px" CssClass="txtBox" TabIndex="19"></asp:TextBox>
<cc1:MaskedEditExtender ID="meeHome" runat="server" TargetControlID="txtHome"
AutoComplete="false" MaskType="None" Mask="999-999-9999" ClearMaskOnLostFocus="true" InputDirection="LeftToRight" />
<%-- <cc1:MaskedEditValidator ID="mevHome" runat="server" ControlToValidate="txtHome"
EmptyValueMessage="Telephone Number is required." ValidationGroup="vUserDetailsB"
ControlExtender="meeHome" InvalidValueMessage="Valid Telephone Number is required."
IsValidEmpty="false" ValidationExpression="^d{3}-d{3}-d{4}&#36;" Font-Size="8pt" />--%>
<asp:RegularExpressionValidator ID="revHome" runat="server" ControlToValidate="txtHome" Display="Dynamic" ErrorMessage="Invalid Home number. Number should be in the format: 555-123-4567" Font-Size="8pt" SetFocusOnError="True" ValidationExpression="d{3}-d{3}-d{4}"
ValidationGroup="vUserDetailsB" Width="100%" meta:resourcekey="txtHomeResource1"></asp:RegularExpressionValidator>
</td>

Whats happenening, If i entered any thing like 5555555555 and it is coverting to this 555-555-5555 format which is correct and then when i moved to another textbox it is throwing error "Invalid Home number. Number should be in the format: 555-123-4567" and this format changes to 5555555555 and its not going ahead.

View 3 Replies

AJAX :: Masked / Mask Edit Extender Not Displaying Currency Correct When In Number Mode?

Mar 3, 2010

I have found a problem with the Masked Edit Extender when using it with a culture of Azeri (Latin, az-Latn-AZ). I have not found anywhere that states that the control should not be used with languages that is not included in the list of languages that the ajax control toolkit is translated.

The currency symbol for Azeri is "man." the first problem is that the mask displays this as "man," but the comma is the decimal indicator for Azeri.

Scenario 1

When the DisplayMoney property is set to "right" and the currency is removed by the masked editors script the resulting value looks something like "12,12," the second comma then invalidates the numeric value and all my compare validator which also acts on the same textbox keeps failing because the value is not numeric.

Scenario 2:

When the DisplayMoney property is set to "left" there is always a "0," added to the string because the the script of the masked editor removes the man then gets to the comma (man",") sees it as a decimal indicator and adds the 0 before the comma this happens on the first blur of the textbox each resulting onblur event will add another 0 to the value. But the value is already invalidated by the fact that it again has two commas like 0,12,12.

I get this result even with the Ajaxcontroltoolkit sample site, the changes needed to sample site's MaskedEdit.aspx page can be seen below.

For scenario 1, change the first MaskedEditExtender on the MaskedEdit.aspx page to the following:

[Code]....

For scenario 2 effect change the first MaskedEditExtender on the MaskedEdit.aspx page to the following:

<ajaxToolkit:MaskedEditExtender ID="MaskedEditExtender2" runat="server"

View 3 Replies

Use Of MaskedEditExtender With Decimal Point?

May 21, 2010

I am using Ajax extender controls with asp.net 3.5 in particular MaskedEditExtender.My settinngs are:

Mask = 99.99
InputDirection = RighttoLeft
MaskType = number.

I can't seem to achieve what I want which is to set the focus just to the left of the decimal point. I try both InputDirection RightToLeft and LeftToRight. They both have problematic behavior. The example given by Microsoft on their web site, is close to want I want but I cannot achieve these results.See

View 1 Replies

C# - Number Decimal Format?

Mar 30, 2011

I have a textbox and user enter a number in it. I want to allow 2 decimal digits. For example; number: 12,256 -> I want to allow 12,25 not 3 digits after comma(2 number after comma). How can I do it?

View 4 Replies

State Management :: Data Being Saved To Wrong Table In Wrong Instance Of Sqlserver Of Wrong Database?

Aug 1, 2010

I have a weird thing happening. I have two identical databases installed on one virtual machine but under two different instances of SQLServer. For some reason, periodically when saving from one it will save to the other instead. Using debug, I have verified that the connection string is correct and when the item saves, it still saves to the wrong database.I use session variable, and am of the belief that it might have something to do with it...and t hat when I go from one to the other it is still getting the connection string form the other for some reason.To make sure that it isn't a problem, I make sure that I completely close out one database before opening the other in a new IE window.I assume that when I completely close out an internet explorer window that it abandons all session states. Is that true?

View 7 Replies

MVC :: Enter Decimal Number In Textbox?

Apr 16, 2010

I want to enter decimal number in textbox,

how to declare it in model?

View 4 Replies

Showing Number In 2 Decimal Places In Gridview?

Oct 13, 2010

i have one Gridview in my .aspx page.i am showing dynamic data in this grid.how i will show the float or double number in 2 decimal places in gridview.

View 3 Replies

Web Forms :: Validation Expression For Decimal Number?

Jan 10, 2011

What is the validation expression for validating numbers with 2 decimal places (Only Zeros).

Each number must have two zeros as decimal places

valid numbers

0.00
23.00
34.00
234.00

Invalid numbers

1.01
1.0
23.06
0.09

View 8 Replies

Web Forms :: Show The Number In Decimal Format

May 3, 2012

how to show the number seperated by comma

1000 to 1,000

I mean here is money format.

View 1 Replies

Calculation Result Has To Many Decimal Number. I Wanna Drop It To Only Two Value?

May 7, 2010

I have a claculation code in my project and it gives the result with too many decimal numbers. I wanna make it shorter as two decimal area. As in sql code, I wanna do a round fuction but I do not know how I could do it in c# ro vb? tolower function?

View 7 Replies

Web Forms :: How To Convert Decimal Amount Number To Word

Jun 25, 2012

i need to convert decimal amount to words for ex:  40300 the Result Should be: Fourty Thousand Three Hundred Rupees only if 40300.35 then:  Fourty Thousand Three Hundred Rupees and Thirty Five Paise only.i have tried many Syntax and Functions bt nthing is Working Correctly,

View 1 Replies

Excel Automatically Formats As A Whole Number Instead Of Keeping The Decimal Places?

Mar 8, 2010

I'm creating an excel file using ASP.net and everything is going just fine except one column has to be formatted as a decimal to 2 places but when it pulls into excel, excel automatically formats it as a whole number instead of keeping the decimal places.

sw.Write(String.Format("{0:f}", CDbl(dr(14)).ToString("0.00"))) this produces "20.00"

but when I open it in excel it's displayed as 20...if I select the whole column and format it as a number it gets displayed as 20.00 like it's supposed to but I don't want to have to do this (I can't do that) the file is supposed to be automatically picked up and imported into another system that needs the column to be a decimal.

View 5 Replies

Web Forms :: Convert Currency Number Amount (without Decimal) To Words

Mar 6, 2014

i want to know how to convert number to word , i want only number no decimal or currency .is there any third party tool?

View 1 Replies

Using ISNULL With DATEDIFF Gives Wrong Number Of Arguments Error?

Jan 31, 2011

I have to believe that I'm just missing something silly on this one. It SHOULD work... but alas, it is not. Here is my code:

SELECT s.[id], s.[familyid], s.[lastname], s.[firstname], s.[middlename], s.[suffix], s.[nickname], s.[dob], fix(datediff(d, isnull(s.DOB, Now()), NOW()) / 365) as AGE, s.[allergies], s.[notes], s.[photographsOK], s.[school], f.[city], f.[state] FROM [Students] s, [families] f, [employee] e where s.[familyid] = f.[id] and f.[franchise] = e.[franchisename] and e.[username] = @Username order by f.[lastname]"

This was working fine before I put the "IsNull"handler in the datediff function to handle problems with null dates. Now I get the following error when I try to run it.Wrong number of arguments used with function in query expression 'fix(datediff('d', isnull(s.[DOB], now()), NOW()) / 365)'. I even tried using just the ISNULL(s.[DOB], NOW()) without the Datediff and get the same error.

View 5 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved