You must Sign In to post a response.
  • Category: ASP.Net MVC

    Change Currency depending on selected country

    Hi,
    I am using MVC5.I want to change currency according to country drop-down changed.I displayed Total Amount and Actual Amount on view page using model as label. I have to use
    extension method for label and also use cookies.For Example: I have 100 as Actual Amount and 200 as Total Amount.When I select India from drop-down list then amounts from that page
    should convert into Rs100 as label of Actual Amount and Rs200 as label for Total Amount. If we select US then that amounts should get convert to related amount and symbol.like $1.55 for 100 and so on. I don't understand how to implement it using extension method for label.
  • #761561
    Hi,

    You can use RegionInfo.ISOCurrencySymbol property to accomplish this task.

    var currencySymbol = new RegionInfo(System.Threading.Thread.CurrentThread.CurrentUICulture.LCID);
    Response.write(currencySymbol.ISOCurrencySymbol);


    Regards,
    Asheej T K
    Microsoft MVP[ASP.NET/IIS]
    DotNetSpider MVM

  • #761566
    Following is the sample to do extension method.
    You can try it.

    public static class YourClassName
    {
    public static Label RegionInfo(this Label aLabelP)
    {
    //Your Current conversion logic
    aLabelP.Text = "VAlue";
    return aLabelP;
    }
    }

    By Nathan
    Direction is important than speed

  • #761585
    Hello Hemalta,

    Refer the below link :

    https://weblog.west-wind.com/posts/2014/Mar/27/Auto-Selecting-Cultures-for-Localization-in-ASPNET

    https://msdn.microsoft.com/en-us/goglobal/bb688126.aspx

    Hope this will help you.

    Regards,
    Nirav Lalan
    DNS Gold Member
    "Failure is the path of least persistence"


Sign In to post your comments