如何从PartialPage.cshtml调用控制器及其操作 假设我有
Html.DevExpress().PageControl(
settings =>
{
settings.Name = "MyTabs";
settings.Width = 520;
settings.Height = 360;
settings.ActivateTabPageAction = ActivateTabPageAction.Click;
settings.EnableHotTrack = true;
settings.SaveStateToCookies = true;
settings.TabAlign = TabAlign.Left;
settings.TabPosition = TabPosition.Top;
settings.TabPages.Add("Houses").SetContent(() =>
{
Html.Render("_RenderTabHousesPartial", Model);
});
settings.TabPages.Add("Apartments").SetContent(() =>
{
Html.RenderPartial("_TabApartmentsPartial", Model);
});
}).GetHtml()
现在我要替换这个Html.RenderPartial(“_ TabApartmentsPartial”,Model);使用呼叫控制器,它将在本节中返回一些数据
settings.TabPages.Add("Houses").SetContent(() =>
{
/Controller/Action/
});
该控制器将负责向我返回包含一些数据的partialView。
这可能吗?
答案 0 :(得分:1)
使用 RenderAction 代替 RenderPartial :
settings.TabPages.Add("Houses").SetContent(() => {
Html.RenderAction(...);
});