Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9012451
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T03:00:00+00:00 2026-06-16T03:00:00+00:00

I have an object like this : public class AppointmentStatus { public int Id

  • 0

I have an object like this :

public class AppointmentStatus 
{
     public int Id {get;set;}
     public string I18NKey {get;set;}
}

The I18NKey refers to a key for the translation.

In my form, I create a dropdownlist using a Select list :

Html.DropDownListFor(x=>x.Id, new SelectList(MyListOfStatus, "Id","I18NKey")

With this I retrieve the value of the key as text, I want to edit the property text in every SelectListItem.

I used something like this :

public static SelectList TranslateValue(SelectList list)
    {
        foreach (var tmp in list)
        {
            tmp.Text = I18nHelper.Message(tmp.Text);
        }
        return list;
    }

But it changes nothing ! The Text property is still the same, why ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T03:00:01+00:00Added an answer on June 16, 2026 at 3:00 am

    I finally found the solution : A SelectList seems to be based on the IEnumerable it needs.
    The property Text of every SelectListItem are dynamics and depends on every item of the IEnumerable.

    We need to change the IEnumerable, not the SelectList :

    What I finally did :

    public class AppointmentStatus 
    {
         public int Id {get;set;}
         public string I18NKey {get;set;}
         public string Translation {get;set;}
    }
    
    public static IEnumerable<AppointmentStatus> TranslateValue(IEnumerable<AppointmentStatus> list)
        {
            foreach (var tmp in list)
            {
                tmp.Translation = I18nHelper.Message(tmp.I18NKey);
            }
            return list;
        }
    
    Html.DropDownListFor(x=>x.Id, new SelectList(HelperClass.TranslateValue(MyListOfStatus), "Id","Translation")
    

    Hope that it will help you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an object like this: public class MyObject{ public int Prop1 {get;set;} }
I have an object model like this: public class MyClass { int TheProp {get;set;}
I have an object like this, public class UserObj { public string First {get;
Say i have a object like this public class Student{ public IList<Coursework> Courseworks{get;set;} public
I have a object structure like this: public class Entity { IList<Relationship> Relationships{get;set;} }
I have an object that looks like this: public class MyObject { public int
Let's say I have an object like this: public class Widget { public string
I have a object model like this public class Parent{ public int Id; public
I have a object like this: public class Test { public String TestValue {
I have a simple object like this public class Test { public string Name

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.