How to copy a repeater on the same page

6

I have a repeater control with data filled in an aspx page, the same page has the modal, the modal appears at the click of a button. How do I reuse the same repeater to list in the modal?

Repeat:

 <asp:Repeater ID="rptPagamentos" runat="server" OnItemDataBound="rptPagamentos_ItemDataBound">
        <ItemTemplate>
            <div class="contexto">
                <span class="font00">Tipo: </span><span class="font01">
                    <asp:Literal ID="ltTipoPagamento" runat="server"></asp:Literal>
                </span>
                <br />

                <span class="font00">Parcelas: </span><span class="font01">
                    <asp:Literal ID="ltParcelasPagamento" runat="server"></asp:Literal>
                </span>
                <br />
                <span class="font00">Valor: </span><span class="font01">
                    <asp:Literal ID="ltValorPagamento" runat="server"></asp:Literal>
                </span>
            </div>
            <br />
            <span class="linha-busca"></span>
        </ItemTemplate>
    </asp:Repeater>

Modal

  <div class="modal fade open" id="myModal" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog">

        <div class="modal-content">
            <div class="modal-header">
                <b>Pedido enviado com sucesso!</b>
                <span><strong>Pedido: </strong></span>
                <asp:Literal ID="LtSeqModal" runat="server"></asp:Literal>
                </span>
            </div>
            <div class="modal-body">
               QUERO O REPEATER AQUI
               QUERO O REPEATER AQUI
            </div>
            <div class="modal-footer">
                <div class="col-sm-12" align="center">

                    <asp:LinkButton ID="LinkButton2" CssClass="btn btn-default" runat="server" OnClick="LinkButton2_Click">Ok</asp:LinkButton>


                </div>
            </div>
        </div>
    </div>
    </div>

How to use the same repeater on the same page within the modal?

    
asked by anonymous 29.04.2015 / 15:21

2 answers

1

So, if it's just to display the reapeater, without any action, you can copy the generated html at runtime and play in your% d% d.

You first get the generated clientId for your repeater, then make a clone and play on your div, without having to create a controler and escambau.

var stormTrooper = $('#myRepeaterId').clone(); //Clona o html do objeto.
$('.modal-body').append(stormTrooper); //Renderiza o clone do repeater

Less code, cleaner.

    
23.12.2015 / 14:55
0

Friend, I could solve your problem maybe if you put the Repeater inside a UserControl and use it instead of the current Repeater and within% with% ...% with%. This would solve the problem of equal layout, but not of persistence (after all they would still be different instances). To persist the same data, the more practical I think it would be when clicking to view modal, copy the values of the internal fields (in this case, the DataSource) and fill in the modal. The loaded DataSource would always be the same object passed to the two instances of UserControl. Upon returning to the first Repeater screen, the same process would have to be done in reverse. This is assuming that the two should appear separately for the user, otherwise the only way to make the user type in one place and update in the other would be to place change events in each of the fields and automatically fill in the other (by code behind giving postback or even javascript).
I'm not sure how the solution works, I hope to help.

    
29.04.2015 / 22:09