Razor Dropdownlist For Each And All Elements
Is there a way to create DropDownList with Razor and pass second parameter as Linq result instead of default empty item? The key is that I'm using accumulator function ('Function')
Solution 1:
Filter method uses delegates that need parameter to construct Linq query.
The problem was that DDL was passing null as result for selecting "All" items in DDL. Because of that Linq was getting a null so expressions like n => n.Name == null obviously didn't work.
To deal with null parameters I used CodeMaster's hint from linked question :
returnView(unitofwork.DomainRepository.Filter(n => n.Name.Contains(searchFullName), n => (String.IsNullOrEmpty(searchExtension) || n.Extension == searchExtension), n => (String.IsNullOrEmpty(searchProject) || n.Project == searchProject)));
Post a Comment for "Razor Dropdownlist For Each And All Elements"