Skip to content

Instantly share code, notes, and snippets.

@vgheri
Created April 16, 2012 14:42
Show Gist options
  • Save vgheri/2399192 to your computer and use it in GitHub Desktop.
Save vgheri/2399192 to your computer and use it in GitHub Desktop.
KnockoutJS data-bind for DropDownLists with MVC 3
public ActionResult Index()
{
var numberOfDropDownMenus = 5;
for (var i = 0; i < numberOfDropDownMenus; i++)
{
var selectList = new SelectList(this.GetDummyItems(i), "Id", "Name", -1);
ViewData["Options_" + i] = selectList;
}
ViewData["DropDownMenus"] = numberOfDropDownMenus;
return View();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment