0

我的目標是創建內容列表(特定的docType)。在這個列表中我有一個過濾器按鈕和兩個ddlist動態填充兒童數據。當用戶點擊「過濾器」時,列表應該被選中的ddlist值更新。 是否有可能爲此使用RenderMVCController?我無法使用surfaceController,因爲我無法在渲染頁面之前訪問Index操作。 當用戶提交表單而不是刷新所有頁面時,是否可以使用Ajax?使用RenderMvcController過濾Umbraco中的列表

查看

using (Html.BeginUmbracoForm("FilterPage", "inTheFieldController", FormMethod.Post, htmlAttributes: new { @id = "PageInTheField" })) 
{ 
//.... 
} 

控制器

public class inTheFieldController : RenderMvcController 
{ 

    private readonly UmbracoContext umbracoContext; 

    public inTheFieldController() 
    { 
     umbracoContext = UmbracoContext.Current; 
    } 


    // GET: inTheField 
    public ActionResult Index()//RenderModel model) 
    { 
} 

,我想有這樣的事情:

[HttpPost] 
    public ActionResult FilterPage(inTheFieldModel model) 
    { 
    return null 
    } 

但是它從未達到過這一點,它要求surfaceController

enter image description here

回答

0

是的,如果你使用的BeginUmbracoForm它總會期待SurfaceController。理想情況下,您應該使用SurfaceController來處理表單。我不清楚你在這裏想做什麼,但你可以使用@Ajax.BeginForm並將它與SurfaceController動作耦合起來。

+0

如果我使用SurfaceControllers,我該如何填充ddlist?在渲染頁面之前,我需要有索引。表面控制器可能嗎? –

+0

使用列表創建視圖模型並從索引操作返回該視圖模型 –