Hello,
Basically You Can Use Javascript/Jquery for this for this.you should assign a specific class such as amount , amountlbl to each textbox & label having number.
The Number should be like this :-12345 to 12,345 not 1,23,45 means in multiple of 3's. But you can modify the regular expression/functions to your requirements[CommaSepratedValues].
I have tired this code for single number in textbox or label.I have assisgned a CSS class amount to textbox and label as amountlbl.
Here is the Java Script Code Using Regular expression
function CommaSepratedValue(nStr)
{ try{
if(nStr!=undefined || nStr !=null){
nStr = nStr.replace(/,/g,'');
nStr += '';
x = nStr.split('.');
x1 = x[0];
x2 = x.length > 1 ? '.' + x[1] : '';
var rgx = /(\d+)(\d{3})/;
while (rgx.test(x1))
x1 = x1.replace(rgx, '$1' + ',' + '$2');
return x1 + x2;
}
}
catch(er){
return nStr;
}
}
Now give the reference to jquery library in head tag
In the end write
$(document).ready(function(){
$(function(){
$(".Amount").keyup(function(){
this.value= CommaSepratedValue(this.value);
});
$(".Amount").each(function(){
if(this.value!=undefined||this.value!=null)
this.value=CommaSepratedValue(this.value);
});
$(".Amountlbl").each(function(){
this.innerHTML= CommaSepratedValue(this.innerHTML);
});
});
});
Hope this Helps You.if you come across any error/difficult let me know.
Happpy Coding :-)