Click here to Skip to main content
14,734,150 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Server Error in '/' Application.
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: CS1061: 'ASP.main_master' does not contain a definition for 'ImageButton1_Click' and no extension method 'ImageButton1_Click' accepting a first argument of type 'ASP.main_master' could be found (are you missing a using directive or an assembly reference?)

Line 18:       <asp:Panel ID="panel2" runat="server" BackColor="#333300" Height="30px" Width="1013">
Line 19:        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Line 20:        <asp:ImageButton ID="ImageButton1" runat="server" Height="31px" Width="126px" ImageUrl="~/images/home.jpg" style="top: 92px; left: 99px" CausesValidation="false" onClick="ImageButton1_Click"></asp:ImageButton>
Line 21:                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Line 22:              <asp:ImageButton ID="ImageButton2" runat="server" Height="31px" Width="126px" ImageUrl="~/images/AdminButton1.jpg" style="top: 92px; left: 99px" onClick="ImageButton2_Click"/>
Posted
Comments
Modi Mayank 23-Mar-15 0:24am
   
If you don't want to use ImageButton click events then remove it from your aspx markup else define it in your codebehind file (c#/vb) to resolve this error as mentioned by "Kornfeld Eliyahu Peter" in Solution 1.

1 solution

By this: onClick="ImageButton1_Click", you try to bind a method as the event handler of the ImageButton click event...That method does not exist...
In you code-behind should be a method - part of that page-class - named ImageButton1_Click...
Check this help page: https://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.imagebutton.onclick%28v=vs.110%29.aspx[^]
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900