473,383 Members | 1,795 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

ASP.NET Data Formatting

I am trying to format some textboxes that I have in my ASP.NET web page.

Can someone tell me if this is possible to do in ASP.NET?
VALUE IN TEXTBOX1 = 500000
VALUE IN TEXTBOX2 = 081604
VALUE IN TEXTBOX3 = 548554486

I would like the user to see the following when they are typing the values
or after they leave the textbox:
VALUE IN TEXTBOX1 = $500,000.00
VALUE IN TEXTBOX2 = 08/16/2004
VALUE IN TEXTBOX3 = 548-55-4486

Thank you for your time.
Nov 18 '05 #1
1 862
To get this in "real time" you'll need to use javascript...just do a good
search for javascript formatters or something.

I just happened to write a function for money:
function formatAsMoney(mnt) {
var amount = String(mnt);
var formatted = '';
for (var i = amount.length-1, t = 1; i >= 0; --i, ++t){
if ((t % 3) == 0){
formatted = ',' + amount.substr(i,1) + formatted;
}else{
formatted = amount.substr(i,1) + formatted;
}
}
if (formatted.substr(0,1) == ','){
formatted = formatted.substr(1,formatted.length-1);
}
return formatted;
}

<input type="text" onKeyUp="this.value = formatAsMoney(this.value);">
"Morys Kenworthy" <ma*******@mutualservice.com> wrote in message
news:OO**************@tk2msftngp13.phx.gbl...
I am trying to format some textboxes that I have in my ASP.NET web page.

Can someone tell me if this is possible to do in ASP.NET?
VALUE IN TEXTBOX1 = 500000
VALUE IN TEXTBOX2 = 081604
VALUE IN TEXTBOX3 = 548554486

I would like the user to see the following when they are typing the values
or after they leave the textbox:
VALUE IN TEXTBOX1 = $500,000.00
VALUE IN TEXTBOX2 = 08/16/2004
VALUE IN TEXTBOX3 = 548-55-4486

Thank you for your time.

Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

24
by: Batista, Facundo | last post by:
Here I send it. Suggestions and all kinds of recomendations are more than welcomed. If it all goes ok, it'll be a PEP when I finish writing the code. Thank you. .. Facundo
21
by: Batista, Facundo | last post by:
Here I send it. Suggestions and all kinds of recomendations are more than welcomed. If it all goes ok, it'll be a PEP when I finish writing/modifying the code. Thank you. .. Facundo
14
by: Steven T. Hatton | last post by:
I'm trying to write a program like hexel. I guess I could fish out the source for hexel and look at that, but for now I'm trying to figure out how I can do with with std::stringstream and...
4
by: hope | last post by:
Hi, How can I format a string field using Data Formatting Expression property in datagrid? For example: format last name from BROWN to Brown. Thanks
1
by: msmcg | last post by:
I need to format the data in some textboxes using the Binding method with custom Currency and ShortDate format and parse handlers. Here is the code that I am using. I call it on the form load...
4
by: Nalaka | last post by:
Hi, I have two questions about gridViews. 1. How can I intercept the row/column values at loading to change values? 2. After I update a row (using default update functionality), how can I...
7
by: David Bear | last post by:
I have a dictionary that contains a row of data intended for a data base. The dictionary keys are the field names. The values are the values to be inserted. I am looking for a good pythonic...
0
by: Randall Arnold | last post by:
I have a Microsoft Access report (built on a SQL Server 2000 query) I have exported as xml/html. I include a stylesheet in the original export for formatting of the report. The schema is...
2
by: =?Utf-8?B?Uml0YUc=?= | last post by:
Hello. I could not find a Web discussion group (only saw Web Services) so am posting my question here. I have a C# Web application that has a form with a datagrid. One of the columns of the data...
6
by: Tomasz J | last post by:
Hello developers, I bind my TextBox control specyfying a format stored in my application global ApplicationContext object - it has a static string CurrencyFormat property. The problem - this...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.