KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a site that was using ASP.Net MVC Beta 5, and I have just upgraded it to ASP.Net MVC 1.0. I am having trouble with the selected item in a drop down list. The follow person has a similar question ( Html.DropDownList in ASP.NET MVC RC (refresh) not pre-selecting item ) but I there is no answer (other than it might be a bug) My Controller method looks as follows: [AcceptVerbs(HttpVerbs.Get)] public ActionResult View(Guid id) { IntegrationLogic logic = new IntegrationLogic(new IntegrationLinq()); CompanyLogic companyLogic = new CompanyLogic(new CompanyLinq()); IntegrationContainer container = new IntegrationContainer(); container.Sources = logic.GetImportSource(id); container.Companies = companyLogic.GetCompanies(); // Returns a IList<company> container.SourceActions = logic.GetAllSourceActions(); // Returns an IList<SourceAction> container.SinkActions = logic.GetAllSinkActions(); container.SuccessActions = logic.GetAllSuccessActions(); container.FailureActions = logic.GetAllFailureActions(); container.Actions = logic.GetAllActions(); container.Watchers = logic.GetAllWatcherActions(); container.ChainActions = logic.GetAllChainActions(); return View("View", container); } The view is a strongly typed against the Model as follows public partial class View : ViewPage<IntegrationContainer> {} The problem area in the view template is : <label for="Companies">Company: </label><%=Html.DropDownList("Companies", new SelectList(ViewData.Model.Companies, "id", "name", item.CompanyID))%> I am creating a Dropdown List, the selected item never actually gets selected - and that is the problem. "item.C
Tags (comma-separated)
Save Edits
Cancel