Base solution for your next web application
Ends in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Pass settings values to @L() in angular js .cshtml views #2839


User avatar
0
bilalhaidar created

Hi, In one of the .cshtml views I have, I need to display a string using @L(). However, this string is parameterized.

How can I get the value for that setting key in an asp.net-way?

I tried the code below, but since I cannot "await" on the function, I get back name of class "Task...".

@{
    var maxPictureSizeName = GetMaxPictureSizeName();
}

@functions {
    private async Task<string> GetMaxPictureSizeName()
    {
        return await SettingManager.(DrcSettings.Imagining.MaxProfilePictureSizeName);
    }
}

3 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    You can do it directly in cshtml like this.

    @L("LocalizationKey", SettingManager.GetSettingValue("NameOfSetting"))
    
  • User Avatar
    0
    bilalhaidar created

    I only see Async methods, I dont see the normal ones. Do I need to add any references to namespaces?

  • User Avatar
    0
    bilalhaidar created

    I added a using for Abp.Configuration and it worked well.

    Thanks