Pregunta

Following is the exact structure of a View in my MVC application.

A view contains ->

  1. LHS: @Html.RenderAction, which invokes an action by supplying some parameters and loads Partial View that is showing a list to the user.

  2. RHS: Another PartialView on this view that contains Filter options. So when user clicks on Submit button on this partial view, it should update the list in LHS.

I have completed loading initial list using @Html.RenderAction.

Now I want to perform calling @Html.RenderAction when user clicks "Submit" button in RHS view. In short, I want to implement 2nd point of my above list.

Any suggestions on this, much appreciated.

¿Fue útil?

Solución

You do that (implement 2nd point) with an ajax form, that posts to an action that returns a partial View for LHS with filtered results. You specify target of that ajax form to be the id of LHS container.

@using(Ajax.BeginForm("actionName", "controllerName", new AjaxOptions { UpdateTargetId = "LHSContainer" }))
{
    ...your filtering inputs and submit button...
}
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top