Solved

Why does the decimal place get shifted when using an ASP.NET MaskedEditExtender?

Posted on 2008-06-24
1
1,076 Views
Last Modified: 2012-08-13
I have a textbox that accepts a monetary rate on an ASP.NET page.  The rate is fetched from a database and populated in the textbox.  Everything works correctly until I add an ASP.NET AJAX MaskedEditExtender to the textbox.  With that in place, the decimal place of the incoming rate (from the database) is shifted 2 decimal places to the right, i.e. $10 is shown as $1000.  Has anyone encountered this problem?
<asp:TextBox 

ID="TextBoxRate" 

runat="server" 

Text='<%# Bind("Rate") %>'>

</asp:TextBox>

<cc1:MaskedEditExtender 

ID="MaskedEditExtenderRate" 

runat="server" 

DisplayMoney="Left" 

InputDirection="RightToLeft" 

Mask="999,999,999.99" 

MaskType="Number" 

TargetControlID="TextBoxRate">

</cc1:MaskedEditExtender>

Open in new window

0
Comment
Question by:pureauto
1 Comment
 

Accepted Solution

by:
pureauto earned 0 total points
ID: 21870777
If you format the money column ('rate' in my case) to Decimal(18, 2) in SQL it will work correctly with the MaskedEditExtender.
CAST(Rate AS DECIMAL(18, 2)) as Rate

Open in new window

0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

If I have to fix slow responding website my first thoughts are server side optimizations: the database may not be optimized or caching is not enabled, or things like that. We often overlook another major part of our web application: the client. We o…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This video teaches viewers how to create their own website using cPanel and Wordpress. Tutorial walks users through how to set up their own domain name from tools like Domain Registrar, Hosting Account, and Wordpress. More specifically, the order in…
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to selectively show certain fields based on user input using rules to gather relevant information and data from your forms. The rules feature provides you with an opportunity…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now