Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Ruder Partap Singh 28 posts 142 karma points
    Apr 05, 2022 @ 19:11
    Ruder Partap Singh
    1

    How to get Dictionary value in viewComponent razor page in umbraco 9

    Hi i want to show the label on page from dictionary as per language selected. my form is loaded through view component.

    Is it possible to use @Umbraco.GetDictionaryValue("myKey") in razor page of view component?

    or any other way to get the Dictionary value in view component?

  • Ambert van Unen 175 posts 818 karma points c-trib
    Apr 06, 2022 @ 07:15
    Ambert van Unen
    101

    In a view you can inject Umbracohelper

    @inject UmbracoHelper umbracoHelper

    and then use

    @umbracoHelper.GetDictionaryValue("Dictionarykey")

    Or you could inject the helper in the _ViewImports.cshtml so you dont need to inject it manually in each view if you need to use it often.

  • Lander Debeuf 23 posts 125 karma points
    Nov 03, 2022 @ 08:53
    Lander Debeuf
    0

    Any update to get the value in the controller? I need it to add error states to the model.

    I used the ILocalisationService, but cannot get the value from the current language, it feels like i am missing something simple

  • Artem 6 posts 77 karma points
    Apr 26, 2023 @ 11:15
    Artem
    0

    Hi Lander Debeuf, please read this article. You will find the answers here: https://docs.umbraco.com/umbraco-cms/reference/querying/umbracohelper

Please Sign in or register to post replies

Write your reply to:

Draft