Is there a way to remove the selectlist parameter below and still use the HTML Helper? I like the strongly typed option, but use knockout.js quite a bit.
@Html.DropDownListFor(m => m.ProgramId, new SelectList(Enumerable.Empty<ProgramModel>()), new { data_bind = "enable: programs().length > 0, value: programId, options: programs, optionsText: 'Name', optionsValue: 'Id', optionsCaption: ' -- Choose Program -- ', event: { change: function(_,event) { getLicenseProductsForProgram() } }" })
No, that’s not possible. The standard DropDownList/DropDownListFor helpers expect an
IEnumerable<SelectListItem>as second argument. Obviously there should be nothing preventing you from writing a custom helper, or custom editor template.