Quick Recap:I have a car website and I have a simple ActionResult with authorization each user that has access to that Controller will have 1 Make of car either a BMW,Honda,Ford or Kia, so that as soon as they login they see the make of car's automatically. I already have the PartialView set but my question is how can I from the ActionResult call the PartialView and fit it inside a DIV within the View?
[Authorize]
public ActionResult Mycars()
{
// How can I return a PartialView here and put it inside a DIV like
// the partialview is called "Mymakes" and its a PartialViewResult
// I just can't seem to put it inside a DIV from here
return View();
}
As said the PartialViewResult works perfectly I have tested it using Ajax.BeginForm now just trying to render it automatically in the ActionResult any tips would be great !!
in your main view (Mycars
), use @Html.Action()
you will create the corresponding Action in your controller (you can set the attribute [ChildActionOnly]
, and it can be of type PartialViewResult
You will then create the (partial) View
corresponding to that PartialViewResult
, and... that's it.