Linkbutton Click event handler not executing

  • Thread starter Thread starter Assaf Weinberg
  • Start date Start date
A

Assaf Weinberg

Using ASP.NET web form with VB.NET

I have a page with a calendar control that
onSelectionChanged builds a table control showing the
events scheduled for the selected calendar days. One of
the columns in this table contains linkbuttons that, when
clicked, should execute some code (currently an event
handler called showEvent) that displays details.

I am currently using addhandler to specify the handler for
the linkbutton click events. When clicked, the
linkbuttons cause a postback, but mysteriously do not
execute the showEvent function.

Here is the code that creates the linkbuttons - it gets
called by the onSelectionChanged of the calendar:

For Each row In editor.dataTable.Rows

Dim tablerow As New TableRow()
Dim dateCell As New TableCell()
Dim titleCell As New TableCell()
Dim officeCell As New TableCell()
Dim link As New LinkButton()
...

'Set linkbutton attributes
link.Attributes("class") = "noDecor"
link.Text = row("eventTitle")
link.ID = "lnk" + CStr(row("eventID"))

'Add click handler
AddHandler link.Click, AddressOf showEvent

'Add all elements to the new tablerow and add
it to the output table
titleCell.Controls.Add(link)
...

Next

Let me know if you have any ideas
 
Back
Top