+ 7
Can you include the call stack? I'd the exception being thrown from the controller or the view? Which line in your code is throwing the exception?
It's a long shot, but this link might help resolve your issue.
https://docs.microsoft.com/en-us/previous-versions/dotnet/netframework-4.0/h32h3abf(v=vs.100)
+ 5
What do you mean by "it overloads the page"? Are you saying it reloads the page?
Are you using a partial view for the AJAX request?
+ 4
Also... Is this using EF Code First?
+ 4
rudolph flash Ah... Your fix makes sense. However, I would have expected a different error message. The issue is related to "deferred execution in LINQ."
Google that phrase to learn more about that. The .ToList() method forces immediate execution to occur.
This isn't ideal because all books are loaded before it is filtered with the Where() method.
There is an optimal approach in writing this. However, I'd need to mess with this using some actual sample data to demonstrate. It might be a few days before I'm able to carve a little time to set something up to work on this for you.
+ 3
I'd need to see the specific exception details to understand the database issue.
Personally, I prefer working with ASP.NET WebAPI with ReactJS frontend.