We are working on an MVC website where some list have user and system values. So, system items need to be internationalized to display in the user language, and user items are already in the user language.
Those system items have a flag called “IsSystem” to differenciate the ones we need to internationalize. This flag also mean that the user cannot update or delete those items.
Well, we are using @Html.DropDownList to render this DropDownList… so I don’t find how to step in the middle of dropdownlist loading logic… in order to place an if statement checking for the IsSystem flag and getting the correct text from resource files.
Thanks for any idea on how to handle this…
EDIT:
Controller code:
ViewBag.idTaskType = new SelectList(db.TaskTypes, "idTaskType", "Name");
where db is Context from EntityFramework
View Code:
@Html.DropDownList("idTaskType", String.Empty)
I am imagining your “TaskTypes” tables as below
Let us consider two different “App_GlobalResources”
[1]en-US
[1]sv
Now develop a IEnumerable SelectListItem
Finally use
Thanks.