Here is my DropDown code:
var fundraiserOrganizations = _fundraiserService.GetFundraiserOrganizations[];
model.AvailableFundraisers.Add[new SelectListItem[] { Text = "---", Value = "0" }];
foreach [var tc in fundraiserOrganizations]
{
if [fundraiserParticipent == null]
{
model.AvailableFundraisers.Add[new SelectListItem[] { Text = tc.FundraiserName, Value = tc.Id.ToString[], Selected = tc.Id == organizationId }];
}
else
{
model.AvailableFundraisers.Add[new SelectListItem[] { Text = tc.FundraiserName, Value = tc.Id.ToString[], Selected = tc.Id == fundraiserParticipent.FK_FundraiserID }];
}
}
Where "organizationId" is the "ID" passed through the URL.
Here is my View code:
@Html.DropDownListFor[model => model.FK_FundraiserID, Model.AvailableFundraisers, new { @disabled = "disabled" }]
Here is a screenshot of my "Model" as it is being returned in the View:
www.ochapparel.com/Content/Images/uploaded/model.png
Now if I already have a participant, then and i'm editing them. Then the dropdown list selects the right one....
Any help is appreciated.