imagebutton click
-
Is this the right way to add an event handler? Dim img As New ImageButton AddHandler img.Click, AddressOf ImageClickHandler img.ImageUrl = Server.MapPath("Pics\aa.gif") Private Sub ImageClickHandler(ByVal sender As Object, ByVal e As ImageClickEventArgs) Response.Redirect("MyBookingNewBooking.aspx.aspx?BookingDate= " & dt & "ResourceName=" & name & "ResourceType=" & type) End Sub But this doesnt work... the page refresh instead of redirect to another page.
-
Is this the right way to add an event handler? Dim img As New ImageButton AddHandler img.Click, AddressOf ImageClickHandler img.ImageUrl = Server.MapPath("Pics\aa.gif") Private Sub ImageClickHandler(ByVal sender As Object, ByVal e As ImageClickEventArgs) Response.Redirect("MyBookingNewBooking.aspx.aspx?BookingDate= " & dt & "ResourceName=" & name & "ResourceType=" & type) End Sub But this doesnt work... the page refresh instead of redirect to another page.
I think you need to declare your method as:
Private Sub ImageClickHandler(...) Handles img.Click
Michael Flanakin Web Log
-
I think you need to declare your method as:
Private Sub ImageClickHandler(...) Handles img.Click
Michael Flanakin Web Log
-
Cannot work. I tried putting in the handles img.click. the imagebutton is create programmatically and it doesnt have the control name so i have error when i do that. Error msg: I guess it's because of the handles...etc.. but hwo can i solve this?
Is the
ImageButton
declared as part of the class? Or, part of a method? Michael Flanakin Web Log -
Is the
ImageButton
declared as part of the class? Or, part of a method? Michael Flanakin Web Log -
Method So what should I do? Currently i just addhandler to my public sub createCalendar in the form behind codes.
Do you have to have the
ImageButton
declared dynamically? If so, why? I would suggest you put theImageButton
declaration in the class and ASPX page. If you don't always need it displayed, make it hidden (Visible="false"
) by default. Michael Flanakin Web Log -
Do you have to have the
ImageButton
declared dynamically? If so, why? I would suggest you put theImageButton
declaration in the class and ASPX page. If you don't always need it displayed, make it hidden (Visible="false"
) by default. Michael Flanakin Web Log