bnil
bnil

Reputation: 1541

how to apply cultureInfo to label in MVC?

I am developing a MVC app.
I have amount fields in my form and I am able to put amounts in Indian decimal style with help of the following code.

@{
    var indianCulture = new System.Globalization.CultureInfo("hi-IN");
    @string.Format(indianCulture, "{0:N}", item.SanctionedAmount)
}

Now I have a line of code where I don't use the item.

 <div class="span7">
   Net Payment 
 </div>
 <div class="span4" id="NetPayment" style="text-align:right;">
   <strong><label for="NetAmt2" > </label></strong>
 </div>

The NetAmt2 value I get from the script. I want to implement culture info to that label, how to do this?

Upvotes: 0

Views: 105

Answers (1)

Santosh Panda
Santosh Panda

Reputation: 7341

You can use this way:

<%: Html.Label(string.Format(indianCulture, "{0:N}", item.SanctionedAmount)) %>

Upvotes: 1

Related Questions