Server Error in '/he' Application.

Sequence contains no elements

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Sequence contains no elements

Source Error:


Line 18: 
Line 19:         Category = categories[int.Parse(Request.QueryString["IndexCategoryID"])];
Line 20:         City = MRW.BLL.Index.IndexCity.LoadByID(int.Parse(Request.QueryString["IndexCityID"]));
Line 21:         
Line 22:         Cards = MRW.Models.IndexModelServices.LoadIndexCards(1, Category.IndexSectionID, Category.IndexCategoryID, City.IndexRegionID, City.IndexCityID, null, new MRW.BLL.Index.OrderByIndexCardID("desc"));

Source File: c:\hosting\bello.co.il\httpdocs\he\000Frames\index\controls\Results.ascx    Line: 20

Stack Trace:


[InvalidOperationException: Sequence contains no elements]
   System.Linq.Enumerable.First(IEnumerable`1 source) +264
   System.Data.Objects.ELinq.<>c__11`1.<GetElementFunction>b__11_0(IEnumerable`1 sequence) +41
   System.Data.Objects.ELinq.ObjectQueryProvider.ExecuteSingle(IEnumerable`1 query, Expression queryRoot) +59
   System.Data.Objects.ELinq.ObjectQueryProvider.System.Linq.IQueryProvider.Execute(Expression expression) +128
   System.Linq.Queryable.First(IQueryable`1 source, Expression`1 predicate) +249
   MRW.Domain.Repositories.Index.IndexCityRepository.LoadByID(Int32 cityID) in D:\Web\Bello\Bello03\Domain\Repositories\Index\IndexCityRepository.cs:20
   MRW.BLL.Index.IndexCity.LoadByID(Int32 cityID) in D:\Web\Bello\Bello03\BLL\Index\IndexCity.cs:37
   ASP.Results.Page_Load(Object sender, EventArgs e) in c:\hosting\bello.co.il\httpdocs\he\000Frames\index\controls\Results.ascx:20
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +51
   System.Web.UI.Control.OnLoad(EventArgs e) +95
   System.Web.UI.Control.LoadRecursive() +59
   System.Web.UI.Control.LoadRecursive() +131
   System.Web.UI.Control.LoadRecursive() +131
   System.Web.UI.Control.LoadRecursive() +131
   System.Web.UI.Control.LoadRecursive() +131
   System.Web.UI.Control.LoadRecursive() +131
   System.Web.UI.Control.LoadRecursive() +131
   System.Web.UI.Control.LoadRecursive() +131
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +678


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.4087.0