如何在Visual Studio 2010中删除以下错误? [英] How to remove the following error in Visual studio 2010?

查看:155
本文介绍了如何在Visual Studio 2010中删除以下错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

'/'应用程序中的服务器错误。 
编译错误

描述:在编译服务此请求所需的资源期间发生错误。请查看以下具体错误详细信息并正确修改源代码。







编译器错误消息:CS1061 :'ASP.main_master'不包含'ImageButton1_Click'的定义,并且没有可以找到接受ASP.main_master类型的第一个参数的扩展方法'ImageButton1_Click'(您是否缺少using指令或程序集引用?)< br $>


第18行:<   asp:Panel     ID   =   panel2    runat  < span class =code-keyword> =  server    BackColor   = #333300   高度  =  30px   宽度  =  1013 >  
第19行:& nbsp;& nbsp;& nbsp;& nbsp;& nbsp;& nbsp;& nbsp;& nbsp;& nbsp;& nbsp ;&安培; NBSP;&安培; NBSP;&安培; NBSP;&安培; NBSP;
第20行:< asp:ImageButton ID = ImageButton1 runat = server 高度 = 31px 宽度 = 126px ImageUrl = 〜/ images / home.jpg style = top:92px; left:99px CausesValidation = false onClick = ImageButton1_Click > < / asp:ImageButton >
第21行:& nbsp;& nbsp;& nbsp;& nbsp;& nbsp;& nbsp;& nbsp;& nbsp;& nbsp;
第22行: < asp:ImageButton ID = ImageButton2 runat = server 高度 = 31px < span class =code-attribute> 宽度 = 126px ImageUrl = 〜/ images / AdminButton1.jpg style = top:92px; left:99px onClick = ImageButton2_Click / >

解决方案

通过这个: onClick =ImageButton1_Click ,你试着绑定一个方法作为ImageButton click事件的事件处理程序...该方法不存在...

在你的代码隐藏应该是一个方法 - 该页面类的一部分 - 名为ImageButton1_Click。 ..

查看此帮助页面: https://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.imagebutton.onclick%28v=vs.110%29.aspx [ ^ ]

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"/>

解决方案

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[^]


这篇关于如何在Visual Studio 2010中删除以下错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆