Question Formatting Number entered in Textbox

LillyPooh

New member
Joined
Aug 24, 2009
Messages
3
Programming Experience
3-5
hey :D

I have a web form with about 5 textboxes that I expect the user to fill with numbers. I need to view those numbers in decimal format (16,2) as soon as the user navigates away from the textbox, even if the user doesn't enter decimal numbers. I know the function that converts to decimal, but I'm a little confused about when and where to call it. I don't want to use the textchanged method with autopostback set to true, cause I already have a couple of drop down lists that use that, and it won't be very user friendly if the page keeps on reloading every time he/she chooses or enters something.

I read somewhere that i could change the textbox data type (which is string by default) to whatever to achieve that, but I couldn't find out how to do that though. Someone told me to try using update panels, but I've never worked with them before and I couldn't find good resources explaining how to use them.

So what you guys suggest I do?

Thanks in advance!
 
Having it on the textboxes and having OnTextChanged code execute wont be a problem if you put all your autopostback controls in an UpdatePanel. That way, only that part of the page will PostBack and your user will be none the wiser.
 
Back
Top