AnithaB
asked on
formatting text in literal control
Hi ,
I'm using a literal controls in table cell for displaying data.
I need to format the data in the following formats
$99,999.99
$99.99
$9.99
How to do this
thanks
Anitha
I'm using a literal controls in table cell for displaying data.
I need to format the data in the following formats
$99,999.99
$99.99
$9.99
How to do this
thanks
Anitha
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for your simple solution
Anitha
Anitha
use javascript:
<scrip language="javascript">
<!--
function formatCurrency(num) {
d=new Date()
if (d.getTimezoneOffset( ) > 60) currSign='$'
else currSign='£'
num = num.toString().replace(/\$
if(isNaN(num))
num = "0";
sign = (num == (num = Math.abs(num)));
num = Math.floor(num*100+0.50000
cents = num%100;
num = Math.floor(num/100).toStri
if(cents<10)
cents = "0" + cents;
for (var i = 0; i < Math.floor((num.length-(1+
num = num.substring(0,num.length
num.substring(num.length-(
return (((sign)?'':'-') + currSign + num + '.' + cents);
}
//-->
</script>
Then inside your Page_Load put the following code:
Literal1.Attributes.Add("o