Thursday, October 04, 2012

Ajax Control Toolkit Masked Edit Extender

Masked Edit Extender

I had a need to use the Masked Edit Extender to limit the number of decimals entered by the user on a Form. It worked great except that I could not get the value of the TextBox that I targeted the extender on the client side. I was only able to get the masked value.

I searched the web and could not find a solution. I ended up writing my own Javscript function to unmask it. It may not be perfect, but works for me. I hope this helps someone.








Formatting Numbers for decimals

Javascript: We can use Number.toFixed(x) to format any number for "x" number of trailing decimals in Javascript In .NET we can use the String Formatting while Databinding the element. See example below for GridView.