编译器错误Cs1061 [英] Compiler Error Cs1061
问题描述
朋友们,我在网络项目上工作。我的页面上有一个按钮,效果很好。但是新的按钮不起作用。相同的代码但不起作用。
编译错误说明:编译服务此请求所需的资源时出错。请查看以下特定错误详细信息并相应地修改源代码。
编译器错误消息:CS1061:'ASP.user_profile_aspx'不包含'Button2_Click'的定义,也没有扩展方法'Button2_Click'接受类型'的第一个参数'ASP.user_profile_aspx'可以找到(你错过了使用指令或汇编引用吗?)
我的.cs页面中的
:
Hi friends , i work on a web project. I have a button on my page and works great. But new buttons don't work. Same code but doesn't work.
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.user_profile_aspx' does not contain a definition for 'Button2_Click' and no extension method 'Button2_Click' accepting a first argument of type ''ASP.user_profile_aspx' could be found (are you missing a using directive or an assembly reference?)
in my .cs page :
public void Button2_Click(object sender, EventArgs e)
{
}
但仍然不起作用。
but still doesn't work.
推荐答案
当出现此错误时您尝试调用方法或访问不存在的类成员。
详细信息:编译器错误CS1061 [ ^ ]
确保您定义新按钮控件的类(您定义其点击事件的位置) ,前Button2& Button2_Click click event)&事件方法public void Button2_Click(object sender,EventArgs e)
属于同一类范围。
This error occurs when you try to call a method or access a class member that does not exist.
Details here: Compiler Error CS1061[^]
Make sure that the class in which you define your new button controls (where you defined their click events too, ex Button2 & Button2_Click click event) & the event methodpublic void Button2_Click(object sender, EventArgs e)
are in the same class scope.
这篇关于编译器错误Cs1061的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!