Base solution for your next web application
Open Closed

Retrieving localized data for dropdown lists #359


User avatar
0
terrybentley created

I have been developing a new project using the ASP.Net Iteration Zero based on the MPA/SLA hybrid sample.

Does anyone have any suggestions as to how best to retrieve and display localized data for drop down lists. I already have service methods that return the values for the entity based on the language code provided although not sure if I should return it as a ListResultOuput or some more specialized DTO like the ComboBoxItemDto

These fields are things like record types, time zones, classifications, etc that need to be repopulated when the language changes. These codes rarely change and really only need to be populated once per session.

Thanks


2 Answer(s)
  • User Avatar
    0
    hikalkan created
    Support Team

    Hi,

    You are free, we have no best practices on that yet. I created ComboBoxItemDto for such situations. If you like it, return a list of ComboBoxItemDto (with combining ListResultOuput, you can use ListResultOuput<ComboBoxItemDto> ).

    BTW, maybe not related to your situation, but you can get localized string directly from javascript (<a class="postlink" href="http://www.aspnetboilerplate.com/Pages/Documents/Localization#DocInJavascript">http://www.aspnetboilerplate.com/Pages/ ... Javascript</a>)

  • User Avatar
    0
    terrybentley created

    Thanks. I was using List<ComboBoxItemDto>, I will switch to the ListResultOuput<ComboBoxItemDto> to see how that looks.

    I am using the localization that you mention for static labels and such but need to access the database for localized text data values.