I’m using ASP.NET MVC in a project and I have a requirement like this..
It has one main View(Main.aspx) and a Action methods to render the main view. And I have another View (SearchResult.aspx) and Action to render the search results content. I need to load the SearchResult page asynchronously in to a DIV in the main View. Is there a way to achieve this?
Thanks
/BB
Yeah that’s pretty simple. Assuming your controller is say “admin” and the action is “users”, your default route for that page is /admin/users. So you can just use the .load method in jQuery to do it like so:
This assumes that the main page has a div with the ID of “searchResults”:
The action just needs to return a partialviewresult. Of course if you set up a custom route or anything in global.asax switch that out for the example URL I provided.