2

A conundrum I am trying to solve looks like this:

Say we have a view the displays a list of buttons, When a button is clicked it can do two thing:

  1. go to the next list of buttons
  2. open an edit form

The entire from containing the list of buttons is actually a partial view called by the parent to be loaded into a modal dialog div container:

so here is the code for the partial _ButtonListForm:

<div class="modal-body" id="buttonsContainer">

@foreach (var item in Model.CategoryTypesList.ListItems)
{
    var ajaxDialogoptions = new AjaxOptions()
    {
        HttpMethod = "GET",
        InsertionMode = InsertionMode.Replace,
        UpdateTargetId = "???",
        OnComplete = "OpenDialog('???');"
    };
    @Ajax.ActionLink(item.ListItemName, item.MainItemActionButton.ActionName, item.MainItemActionButton.ControllerName, item.MainItemActionButton.RoutValues, ajaxDialogoptions, new { Class = "btn btn-large btn-info btn-block" })
}
</div>

I cannot set the UpdateTargetId to buttonsContainer because then it will load the entire view with another buttonsContainer and after another button is click it will do that again an again etc...

How do i make a click on the ajax action link to update the entire partial view what would be the UpdateTargetId ?

I know I can create another partial that will only list the buttons and that will update a target from the parent partial but then you will have to remember to change the parent if something gets updated and that does not seem like a good design (or is it ? )..

RickL
  • 3,318
  • 10
  • 38
  • 39
Mortalus
  • 10,574
  • 11
  • 67
  • 117

0 Answers0