Ken Cox said:
Hi Tom.
If you're talking about the server-side Click event then the signature
would look like this:
Private Sub ImageButton1_Click _
(ByVal sender As System.Object, _
ByVal e As System.Web.UI.ImageClickEventArgs) _
Handles ImageButton1.Click
End Sub
Is that what you meant?
Here is an asp:Button line with the onClick method
<asp:Button ID="CollapseAll" text="Collapse All"
runat="server" Font-Size="2" onClick="collapseAll_click" Width="16"
Height="16" AlternateText="Click here to see
details"></asp:Button>
If you take the following line:
<asp:ImageButton ID="ExpandButton" runat="server"
Font-Size="2" ImageUrl="../images/expand.jpg" Width="16" Height="16"
CommandName="Select" AlternateText="Click here to see
details"></asp:ImageButton>
And change it to:
<asp:ImageButton ID="ExpandButton"
onClick="ExpandButton_click" runat="server" Font-Size="2"
ImageUrl="../images/expand.jpg" Width="16" Height="16" CommandName="Select"
AlternateText="Click here to see details"></asp:ImageButton>
You get the following message:
Compilation Error
Description: An error occurred during the compilation of a resource required
to service this request. Please review the following specific error details
and modify your source code appropriately.
Compiler Error Message: BC30408: Method 'Public Sub
ExpandButton_click(sender As Object, e As System.EventArgs)' does not have
the same signature as delegate 'Delegate Sub ImageClickEventHandler(sender
As Object, e As System.Web.UI.ImageClickEventArgs)'.
Thanks,
Tom
Ken
Microsoft MVP [ASP.NET]
tshad said:
I was trying to change my asp:button to asp:ImageButton, but got a message
saying that ImageButton does not have an onClick function.
How do I get the ImageButton call a function?
Thanks,
Tom.