I used dropdown for search. The text value should different from the value. So, I created 2 types of methods:
List<string> lstRoles = new List<string>();
lstRoles = _repository.GetRolesForFindJobseekers();
List<string> lstFunctions = new List<string>();
lstFunctions = _repository.GetFunctionsForRolesFindJobSeekers();
List<SelectListItem> selectListRoles = new List<SelectListItem>();
int i = 1;
foreach (string role in lstRoles)
{
selectListRoles.Add(new SelectListItem
{
Text = role,
Value = role,
Selected = (i == 0)
});
i++;
}
ViewData["RolesForJobSeekers"] = selectListRoles;
lstFunctions
should come in the value field. How will I add this?