Can someone please tell me on how to load PartialView
in the same page when clicking on Html.ActionLink
. I have listed down my requirements below.
- I have an Index page which will list the employees from Employee table, also each row in a table will have Edit & Delete link (Html.ActionLink) to update/delete the employee information.
- Also, Index page will have partial view with textboxes to create new employee (or) editing an existing employee.
- When user select Edit link from the table, appropriate user details has to be loaded in the textboxes of partial view to update the employee detail.
- Also, new employee details entered in partial view should get stored into the DB table and at the same time it should get added into the table in Index page.
All the above steps should handle without using Ajax in MVC5. Can anyone please help me to achieve the above steps? Your help is much appreciated
Once your view is rendered the only way to load a partial view is via an Ajax call which returns the partial view to your JQuery/Javascript and then updates the DOM accordingly.
For instance:
Your HTML
Your JQuery:
Your controller action: