View Full Version : ASP.NET MVC and EXT JS Combo Box

10 Feb 2011, 2:09 PM
Hello, I'm trying to do something relatively simple and I think I'm missing something. All I'm trying to do is call a LINQ to SQL query in ASP.NET MVC and pass the JSON result to an EXT JS Combo box.

My Controller looks like this:

public ActionResult AllClients()
var clients = repo.GetAllClients();

return Json ( new { Data = clients }, JsonRequestBehavior.AllowGet);

My MVC Model method looks like this:

public IQueryable<Client> GetAllClients()
return contx.Clients;

My EXT JS Json Store Code looks like this:

var clientStore = new Ext.data.JsonStore({
url: '/GUIStuff/AllClients',
fields: ['ID', 'Name', 'Type'],
root: 'Data'

I know some have suggested not using IQueryable<> for JSON, but other say adding .ToList() solves any issues. I've tried this code with and without .toList() and the combo box does not populate.

When I evoke the JSON controller above, I get a JSON file in this format:


I did get one box to work that returned an array type with a container class, but using similar methods here ended up with squat.

Thank you!