I follow the steps in this example
https://www.aspsnippets.com/Articles/Implement-Delete-with-Confirmation-in-ASPNet-Repeater-control.aspx
But i got error :
Object reference not set to an instance of an object.
here's where the exception happen
and here's my code in the design:
<asp:Repeater ID="rpdetails" runat="server">
<HeaderTemplate>
<table class="table table-hover" id="tblData" >
<tr class="table-success"">
<th></th> <th class="text-nowrap">Report Time </th><th class="text-nowrap">Reported by</th><th class="text-nowrap">Current Position</th><th>Procedure</th><th class="text-nowrap">Taken by</th><th class="text-nowrap">Problem desc</th><th>Shift</th><th>Problem State</th>
</tr>
</HeaderTemplate>
<ItemTemplate><tr dir="ltr">
<td align="left">
<asp:LinkButton ID="lnkDelete" Text="Delete" runat="server" OnClientClick="return confirm('Do you want to delete this Report?');"
OnClick="DeleteRep" />
</td>
<td>
<asp:Label ID="time" runat="server" Text='<%# Eval("reporting_time") %>' />
</td>
<td>
<asp:Label ID="Label1" runat="server" Text='<%# Eval("repby") %>' />
</td>
<td align="left">
<asp:Label ID="Label2" runat="server" Text='<%# Eval("curr_pos") %>' />
</td>
<td align="left">
<asp:Label ID="pro" runat="server" Text='<%# Eval("procedure_taken") %>' />
</td>
<td>
<asp:Label ID="Label3" runat="server" Text='<%# Eval("takenBy") %>' />
</td>
<td align="left">
<asp:Label ID="desc" runat="server" Text='<%# Eval("pro_desc") %>' />
</td>
<td>
<asp:Label ID="Label4" runat="server" Text='<%# Eval("shift") %>' />
</td>
<td align="left">
<asp:Label ID="Label6" runat="server" Text='<%# Eval("problem_status") %>' />
</td>
</tr></ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
Protected Sub DeleteRep(s As Object, e As EventArgs)
Dim r As New problem()
Dim repId As Integer = Integer.Parse(TryCast(TryCast(s, LinkButton).NamingContainer.FindControl("pIDlbl"), Label).Text)
Dim result As String = r.removeP(Session("userId"), repId)
Dim p As New device()
rpdetails.DataSource = p.getAllProblems()
rpdetails.DataBind()
End Sub