Hi
I have followed the example of deleting a row from a repeater control from the following link found on this site Implement Button Click event in ASP.Net Repeater control.
In your example you have used an int value as your unique identifier and in my case i want to use a string which is an email address.
Please assist in explaining how i should make when working with a string value that needs to be deleted from a row in a repeater control.
Repeater Control
<asp:Panel ID="pnlEmailRecipients" CssClass="panel panel-success" Visible="true"
runat="server">
<div class="panel-heading">
<h3 class="panel-title" style="text-align: left;">
Email Recipients</h3>
</div>
<div class="panel-body">
<div class="table-responsive">
<asp:Repeater ID="rpEmailRecipients" Visible="true" runat="server">
<HeaderTemplate>
<table class="table table-striped table-hover table-condensed">
<thead>
<tr>
<th>Email</th>
<th>Employee Code</th>
<th>Name</th>
<th>Surname</th>
</tr>
</thead>
<tbody>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td><asp:Label Text='<%#Eval("Email") %>' runat="server" ID="lblEmail" /></td>
<td><asp:Label Text='<%#Eval("Code") %>' runat="server" ID="Code" /></td>
<td><asp:Label Text='<%#Eval("FirstName") %>' runat="server" ID="FirstName" /></td>
<td><asp:Label Text='<%#Eval("LastName") %>' runat="server" ID="LastName" /></td>
<%--<td><asp:Button ID="btnRemoveRecipient" Width="50%" Height="100%" OnClick="btnRemoveRecipient_Click1" CssClass="btn btn-success pull-right" Text="remove" runat="server"/></td>--%>
<td><asp:LinkButton ID="btnDeleteEmailRecipient" CssClass="btn btn-success pull-right" OnClick="btnDeleteEmailRecipient_Click" OnClientClick="return confirm('Do you want to delete this row?');" runat="server">Remove</asp:LinkButton></td>
</tr>
</ItemTemplate>
<FooterTemplate>
</tbody> </table>
</FooterTemplate>
</asp:Repeater>
</div>
</div>
</asp:Panel>
Code Behind
Protected Sub btnDeleteEmailRecipient_Click(sender As Object, e As EventArgs)
Dim item As RepeaterItem = TryCast(TryCast(sender, LinkButton).Parent, RepeaterItem)
Dim lblEmail As Integer = Integer.Parse(TryCast(item.FindControl("lblEmail"), Label).Text)
Try
mLMS = New aplLumotechMedicalSurveillance(My.Settings.HRDB)
mLMS.DeletEmailRecipient(lblEmail)
GetEmailRecipients()
Catch ex As Exception
Throw ex
End Try
End Sub