asp.net MVC partial view controller action

Viewed 100063

I'm very new to web app development and I thought I would start with recent technology and so I'm trying to learn asp.net as-well as the MVC framework at once. This is probably a very simple question for you, MVC professionals.

My question is should a partial view have an associated action, and if so, does this action get invoked whenever a normal page uses RenderPartial() on the partial view?

5 Answers

The accepted answer is completely correct, but I want to add that you can load your partial view using jQuery load. Less configuration needed, if you don't want to consider concurrency.

$("#Your-Container").load("/controller/action/id");
 public ActionResult GetStateList(int country_id)
 {
      List<stateDTO> stateList = new List<stateDTO>();
      stateList = bll.GetState(country_id);
      ViewBag.sList = new SelectList(stateList, "state_id", "State_Name");
      return PartialView("DisplayStates");
 }
Related