How to modify the currency symbol in Blazor Numeric Textbox

Answer:


Set the currency code in the startup.cs file as shown in the code example below to render the Numeric Textbox component with the Corresponding culture.

[startup.cs]

public void ConfigureServices(IServiceCollection services)

{

services.AddSyncfusionBlazor();

services.AddLocalization(options => options.ResourcesPath = "Resources");

services.Configure<RequestLocalizationOptions>(options =>

{

// // define the list of cultures your app will support

var supportedCultures = new List<CultureInfo>()

{

new CultureInfo("en-US"),

new CultureInfo("de")

};

// set the default culture

options.DefaultRequestCulture = new RequestCulture("de");

options.DefaultRequestCulture.Culture.NumberFormat.CurrencySymbol = supportedCultures[1].NumberFormat.CurrencySymbol;

options.SupportedCultures = supportedCultures;

options.SupportedUICultures = supportedCultures;

options.RequestCultureProviders = new List() {

new QueryStringRequestCultureProvider()

};

});

services.AddRazorPages();

services.AddServerSideBlazor();

services.AddSingleton(typeof(ISyncfusionStringLocalizer), typeof(SampleLocalizer));

services.AddSingleton<WeatherForecastService>();

}


[index.razor]

@using Syncfusion.Blazor.Inputs

<SfNumericTextBox TValue="int?" Format="c2">SfNumericTextBox>



Loader.
Up arrow icon