c# - ASP.NET MVC Sequence contains no matching element -



c# - ASP.NET MVC Sequence contains no matching element -

i new asp.net mvc. have finished project unusual issue appeared in project.

as seek run project error message.

an exception of type 'system.invalidoperationexception' occurred in entityframework.dll not handled in user code additional information: sequence contains no matching element

in 1 of controller using statement below groups display in dropdownlist.

http://localhost....../clients (trying run page) , getting error on line containing code below. viewbag.groupdropdownvalues = new selectlist(db.groups.orderby(m => m.groupid), "groupid", "groupname");

or other controller:

viewbag.categorydropdownvalues = new selectlist(db.category.orderby(m => m.categoryid), "categoryid", "categoryname");

this happening in controllers using syntax.

i need display dropdownlists values database. working correctly till morning. don't have thought changed , started throwing these errors.

i have tried other solutions suggested in utilize firstordefault or singleordefault

like sequence contains no elements error inheritance

but nil changed. think not selecting single value list of values.

please suggest or guide in right direction thankful.

------------- edit ---------------

@model app.models.policy @using (html.beginform("search", "", formmethod.get, new { id = "search-form", @class = "form-horizontal" })) { <div class="span4 "> <div class="control-group"> <label class="control-label" for="groupid">group</label> <div class="controls"> @html.dropdownlist("group", (selectlist)@viewbag.groupdropdownvalues, "---select grouping ---", new { @class = "m-wrap span12" }) </div> </div> </div> }

c# asp.net asp.net-mvc asp.net-mvc-4

Comments

Popular posts from this blog

java - Parsing XML, skip certain tags -

rest - How to invalidate user session on inactivity in a stateless server? -