Hacker News new | ask | show | jobs
What's the expected way of doing interactive searchbar in ASP.NET MVC?
1 points by pkrzysiek 467 days ago
Hello, I want to be able to use an input that would dynamically show me a limited list of results from some set (List) or the partial results from DB.

I want to let the user use the input to type the book's author and present to him the list of matching author that exist in DB.

2 comments

I think keeping it simple would be the best, use jquery with some search plugin and call a REST endpoint from your dotnet backend.
Thanks, I've done it with jquery and ajax get request but it feels so outdated, especially when operating on such big abstraction layer that ASP.NET MVC is
Yes, but the essence of the problem statement is client interactivity so it boils down to JavaScript calling web services. MVC only abstracts the server part. If you want something modern in that space you could try blazor - C# with WASM on the client.
I would integrate HTMX into your project. Page can call controller with input and replace client area with your search results.