The result of a query cannot be enumerated more than once
Try explicitly enumerating the results by calling ToList()
.
Change
foreach (var item in query)
to
foreach (var item in query.ToList())
Try replacing this
var query = context.Search(id, searchText);
with
var query = context.Search(id, searchText).tolist();
and everything will work well.
if you getting this type of error so I suggest you used to stored proc data as usual list then binding the other controls because I also get this error so I solved it like thisex:-
repeater.DataSource = data.SPBinsReport().Tolist();repeater.DataBind();
try like this