aspx:PartialView
PartialView allows another action to be shown as a partial page (widget) inside another ActiveTemplate or ActivePage:
<aspx:PartialView id='mypartialview' area="aspx" action="myaction" controllerName="MyPageName" runat="server"/>
Properties
| Property | Description |
|---|
| ControllerName | String, name of the controller |
| Action | String, name of the action |
| Area | String, area of the controller such as Force, DynamicsCrm, etc. |
| RecordId | String, ID of the record if any (optional) |
| Parameteres | List, additional URL parameters. |
In order to support partial views/widgets, you need to design your action in the following way:
public class MyPageNameController : AspxController
{
public ActionResponse MyAction()
{
//add your code
Contact model = new Contact();
return PartialView(model);
}
}
Passing Parameters
PartialView also allows you to pass extra parameters that are mapped to your Action arguments:
<aspx:PartialView id='mypartialview' area="aspx" action="myaction" controllerName="MyPageName" runat="server">
<parameters>
<aspx:Param name="id" value='<%# Model.Id %>' runat="server"/>
</parameters>
</aspx:PartialView>
You can then update your Action to accept the "id" parameter:
public class MyPageNameController : AspxController
{
public ActionResponse MyAction(string id)
{
//add your code
Contact model = Database.Query<Contact>().Where(a=>a.Id == id).First();
return PartialView(model);
}
}