Hi I'm adding image buttons to each day in a calendar control in the calendars dayrender event. I can add the buttons no problem, but I'm struggling to get a subroutine to handle their click. Please see the code below. I want each button to point to the same sub.
I get this error in visual studio:
Method 'Private Sub DayBtn_Click(sender As Object, e As System.Web.UI.WebControls.CommandEventArgs)' does not have a signature compatible with delegate 'Delegate Sub ImageClickEventHandler(sender As Object, e As System.Web.UI.ImageClickEventArgs)'.
Thanks
Mik.
VB.NET:
Protected Sub Calendar1_DayRender(sender As Object, e As System.Web.UI.WebControls.DayRenderEventArgs) Handles Calendar1.DayRender
'create the buttons
Dim pm As New ImageButton
pm.ID = "PMButton" & e.Day.DayNumberText
pm.ImageUrl = "Images/Calendar/HalfDay.jpg"
pm.CommandName = "HalfDayPM"
pm.CommandArgument = e.Day.Date
AddHandler pm.Click, AddressOf DayBtn_Click
e.Cell.Controls.Add(pm)
End Sub
Private Sub DayBtn_Click(sender As Object, e As CommandEventArgs)
LabelCalendar.Text &= e.CommandName.ToString()
End Sub
I get this error in visual studio:
Method 'Private Sub DayBtn_Click(sender As Object, e As System.Web.UI.WebControls.CommandEventArgs)' does not have a signature compatible with delegate 'Delegate Sub ImageClickEventHandler(sender As Object, e As System.Web.UI.ImageClickEventArgs)'.
Thanks
Mik.