Insert value into selectlist
- by William
I need to insert a value into a selectlist. It isn't the "0" value (i.e. the first one that shows) but the next one which would be "Other". This is then used to display an "Other" textbox.
My question is similiar to link text.
EDIT:
I don't know if this will help but here is the code:
SelectList Titles;
ViewData["TitleIsOther"] = TitleIsOther(Case);
if ((bool)ViewData["TitleIsOther"])
{
Titles = new SelectList((LookupCollection)this.LookupRepository.FetchByCategory(true, 0, 0, false,
(int)Enums.LookupCategory.CaseTitles, _LoggedInUser.AccountId), "Id", "Name", "-1");
}
else
{
Titles = new SelectList((LookupCollection)this.LookupRepository.FetchByCategory(true, 0, 0, false,
(int)Enums.LookupCategory.CaseTitles, _LoggedInUser.AccountId), "Id", "Name");
}
ViewData["Titles"] = Titles;
The selected value of "-1" would be the "Other" option.