Same partial view within several modal popup

0

I have content that is inside a partial view. There are situations where I need to open popup's that only change the buttons and their actions.

But the content is always the same as partial view . I believe that when rendering the page, the same partial view is created for each popup , and thus the id's of the HTML components are repeated. This messes up all the code.

For example, it loses grid reference from tabpage .

Does anyone know how to reuse the same partial view in several popup's ?

<div id="divModal">
    @Html.Partial("DadosComuns")
</div>

<script>
    $(document).ready(function () {

        dialog-01 = $("#divModal").dialog({
            autoOpen: false,
            title: "Tela 01",
            modal: true,
            buttons: {
                "Ação A": function() {
                    AcaoA();
                },
                "Fechar ": function() {
                    dialog-01.dialog('close');
                }
            }
        })

        dialog-02 = $("#divModal").dialog({
            autoOpen: false,
            title: "Tela 02",
            modal: true,
            buttons: {
                "Ação B": function() {
                    AcaoB();
                },
                "Ação C": function() {
                    AcaoC();
                },
                "Fechar ": function() {
                    dialog-02.dialog('close');
                }
            }
        })

        dialog-03 = $("#divModal").dialog({
            autoOpen: false,
            title: "Tela 02",
            modal: true,
            buttons: {
                "Ação D": function() {
                    AcaoD();
                },
                "Ação E": function() {
                    AcaoE();
                },
                "Fechar ": function() {
                    dialog-03.dialog('close');
                }
            }
        })
    }
</script>
    
asked by anonymous 22.08.2017 / 15:13

1 answer

0

I decided to change the id's of the HTML elements. Like this: $ ("# grid"). attr ('id', 'grid-01');

    
22.08.2017 / 21:10