public static List <SelectListItem> GetAllUsers(string userstatus) //valid values are Active, Inactive and All { List <SelectListItem> userlist = new List <SelectListItem>(); var dc = new UsersDataContext(); var result = dc.S1_Users_GetAllUsers(userstatus); foreach (var item in result) { if (item.UserID != null) { SelectListItem listitem = new SelectListItem(); listitem.Value = item.UserID.ToString(); listitem.Text = item.ShortName; userlist.Add(listitem); } } return(userlist); }