Below is my code for the table of contents to display. I get the content from the database properly to display on the web page. I have added the linkbuttons with respect to the content fetched from the database to the table. I don't know why, the linkbutton does not fire the event added to it. Could anyone tell me why and what causes the event not to fire?
ASPX:
<form id="myForm" runat="server">
<asp:ScriptManager runat="server" ID="spm1" />
<asp:UpdatePanel runat="server" ID="up1">
<ContentTemplate>
<table runat="server" id="doctorList" class="mel-table" style="text- align:center">
<tr>
<td class="mel-table-header">Doctor Code</td>
<td class="mel-table-header">First Name</td>
<td class="mel-table-header">Last Name</td>
<td class="mel-table-header">Is Active?</td>
<td class="mel-table-header">Update</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
</form>
ASPX.VB:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim content As String = ""
If Not IsPostBack Then
Dim docBOs As List(Of BO_Doctors) = docList.getDoctors()
// This brings the Doctors List from Database properly
For Each docB As BO_Doctors In docBOs
Dim tr As New HtmlTableRow
Dim td1 As New HtmlTableCell
td1.InnerText = docB.docCode
tr.Cells.Add(td1)
Dim td2 As New HtmlTableCell
td2.InnerText = docB.docfName
tr.Cells.Add(td2)
Dim td3 As New HtmlTableCell
td3.InnerText = docB.doclName
tr.Cells.Add(td3)
Dim td4 As New HtmlTableCell
td4.InnerText = docB.isActive
tr.Cells.Add(td4)
Dim td5 As New HtmlTableCell
Dim editBtn As New LinkButton
editBtn.Text = "Edit"
editBtn.ID = docB.docCode
AddHandler editBtn.Click, AddressOf editBtn_Click
td5.Controls.Add(editBtn)
tr.Cells.Add(td5)
doctorList.Rows.Add(tr)
Next
End If
End Sub
Protected Sub editBtn_Click(sender As Object, e As EventArgs)
Dim btn As LinkButton = CType(sender, LinkButton)
Dim doc As BO_Doctors = docList.getaDoctor(btn.ID)
End Sub