This article shows how you can populate MVC Listbox using jQuery and JSONResult. It uses static values and also shows with model values which can use database values.
By using this repository code you will save Categories as JSON file and read it using jQuery getJSON method. This also helps you to read from Controller Action method that returns JSONResult.
- Categories JSON file - has list of Categories in JSON format.
- Index HTML View - shows a ListBox filled from the values returned by JSONResult.
- Controller - Returns JSONResult to View.
ASP.NET MVC List box will be shown as
For more info see - Populate ASP.NET MVC List box using jQuery getJSON or JSONResult