What command can I use to delete an item from a Repeater in c# Asp.net

Asked

Viewed 95 times

0

I am trying to delete an item from a Reset, this item is a "registered" person. Because there is no database involved

I am aware of Repeater1.Controls.Remove, but this does not exclude.

Information such as: name, email, Cpf is "registered" in a list. What other command can I use??

Note: I cannot make use of Javascripit on this page

1 answer

1

You can put an if on Repeater. I believe this should help you. For example the code here has a currentItem if.

<table cellpadding="0" cellspacing="0">
    <asp:Repeater ID="Repeater1" runat="server">
        <ItemTemplate>

            <% if ( (CurrentItemCount % 2) == 0 ) { %?>
            <tr id="itemRow" runat="server">
            <% } %>
                <td>
                    Some data
                </td>
            <% if ( (CurrentItemCount % 2) == 0 ) { %?>
            </tr>
            <% } %>
        </ItemTemplate>
    </asp:Repeater>
</table>

For you to get information from the list item you can use the direct call to variable.

Thus:

<asp:repeater runat="server">
<itemtemplate>
    <%# if ((bool) DataBinder.Eval(Container.DataItem, "IsEmpty")) { %>
       ALO
    <%#}%>
</itemtemplate>
</asp:repeater>

More info: https://forums.asp.net/t/1766065.aspx?if+statement+in+repeater+control

  • Thank you very much!!

  • =) only gives ok on the arrows there. valews

Browser other questions tagged

You are not signed in. Login or sign up in order to post.