I have some records. Upon clicking on every record there information needs to display in an accordion.
That information is supposed to fetch from database dynamically.
What i’ve done so far is
Create a partial view. That is suppose to display the detailed information.
Upon click on record, i call jquery method and execute my method on controller. Controller returns object in the form of Json(or any other thing, open for any suggestions).
Now JQuery method has that (Model)object, but how could i use it to
render my partial view from it.
There are two ways you can achieve what you desire. I guess you have to return a partial view from the action that gives a detailed information about the record.
$("#accordion-container-1").load(url).Ex.
From your comment I see you have to pass the
orderNothe action as parameter. So you have to set theorderNoas id or append that to some string (to avoid duplicate ids in elements) and set to the id for the anchor link.Then,
Ajax.ActionLinkthat call some controller action through ajax and update the html result to a container.Ex.
In this case when you are generating the records through looping the collection you have to create the links (on click has to load the content through ajax) through
Ajax.ActionLinkmethod and also you have to include thejquery'unobtrusive.ajax.jslibrary.Update based on OP’s comment
Your action method should be something like this,
You should have a partial view either with the name
Tracking.cshtmland inside the partial view you have to create the html the represents the detailed information of the record that you were talking about.Tracking.cshtml
When you call the action
Trackingfrom jquery or through ajax action (as i described previously) you will get partial view html that you can load into a particular container like div.