I have a view that list Parts in a htmltable format from a database table PartList. The htmltable contains a link which should be used to enter values to the database table Bom. When clicked on the link, it should load a partialview for that particular Part. The partialview contains a dropdown to select the child part, a textbox to enter the quantity and a htmltable that shows the other bom enter for that part. What am struck up with is I need to load the partialview accepting the partId using ajax. The partialview should be loaded to a div in the listPart view. How to acheive this?
Share
You are not clear about your question by not showing your current code. As far as I understood, this blog post should give you an idea:
Working With JQuery Ajax API on ASP.NET MVC 3.0 – Power of JSON, JQuery and ASP.NET MVC Partial Views
What you need to do is simple:
Make an ajax call to you controller action:
Return your partial view:
RenderPartialViewToStringis a controller extension which renders your partial view inside your controller and return back a string value for the output. You will find all the code inside the blog post.