Now my intention is to use this value (the ID) in a callback to the controller to filter down the ActiveEntities. So here is the Action method (it is just the Index of the controller).
public ActionResult Index()
//Build the initial entity query to filter down
_viewModel.ActiveEntities = _db.Entities.AsEnumerable();
if (_viewModel.PlatformFilterId != 0)
//Filter by the platform ID
_viewModel.ActiveEntities = _viewModel.ActiveEntities.Where(e => e.Platform == _viewModel.PlatformFilterId);
//Ensure the query is run
_viewModel.ActiveEntities = _viewModel.ActiveEntities.ToList();
Seems simple enough but maybe this is already wrong.... And here is the view:
The outcome is that I get my dropdown populated correctly, but on the postback (i.e. the Index action method firing after I click "Filter") the PlatformFilterId is always 0 so of course I can never filter. What am I doing wrong?
Any help is appreciated.
Computers have been intelligent for a long time now. It just so happens that the program writers are about as effective as a room full of monkeys trying to crank out a copy of Hamlet.
Last Visit: 31-Dec-99 18:00 Last Update: 20-Aug-14 3:38