0

my goal is to create a list of contents (of specific docType) . in this list I have a filter button and two ddlist dynamically filled with children data. when user click the "filter" , the list should be updated by selected ddlist values. Is it possible to use RenderMVCController for this ? I couldnt used surfaceController because I cant have access to Index action before rendering the page. Is it possible to use Ajax when user submit the form instead of refreshing all page?

View

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

Controller

public class inTheFieldController : RenderMvcController
{

    private readonly UmbracoContext umbracoContext;

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


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

and I want to have something like this:

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

But it never reached to this point,it asks for surfaceController.

enter image description here

1 Answer 1

0

Yes, if you use the BeginUmbracoForm it will always expect a SurfaceController. Ideally you should be using SurfaceController for forms. I dont clearly understand what you are trying to do here but you can use @Ajax.BeginForm and couple it with a SurfaceController action

Sign up to request clarification or add additional context in comments.

2 Comments

If I use SurfaceControllers , how can I fill ddlist ? I need have Index before rendering the page. Is it possible with surface controllers?
create a view model with a list and return that view model from the index action

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.