页面"analysis_aspx"不包含"Button1_Click"的定义,也没有扩展方法"Button1_Click" [英] page 'analysis_aspx' does not contain a definition for 'Button1_Click' and no extension method 'Button1_Click

查看:102
本文介绍了页面"analysis_aspx"不包含"Button1_Click"的定义,也没有扩展方法"Button1_Click"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的错误CS1061:"analysis_aspx"不包含"Button1_Click"的定义,并且找不到扩展方法"Button1_Click"接受类型为"analysis_aspx"的第一个参数(您是否缺少using指令或程序集引用?)

this is my error CS1061: 'analysis_aspx' does not contain a definition for 'Button1_Click' and no extension method 'Button1_Click' accepting a first argument of type 'analysis_aspx' could be found (are you missing a using directive or an assembly reference?)

我在aspx文件中的代码:

my code in aspx file:

<asp:Button ID="Button1" CssClass="btn" runat="server" Text="Happy" Font-Bold="True" Font-Size="Medium" Height="40px" Width="100px" OnClick="Button1_Click" />

我有3个这样的按钮.

.cs文件后面的代码是

my codebehind that is .cs file is

protected void Button1_Click(object sender, EventArgs e)

我已经看到一些相关的问题,但是在大多数问题中,他们缺少一些东西,所以他们得到了错误,但是对我来说,我不知道为什么我会收到此错误.

i have seen some related questions but in most questions they are missing something so they got the error but for me i don,t know why i am getting this error .

有人可以告诉我正确的方向.在此先感谢

someone can show me the right direction. Thanks In Advance

推荐答案

我遇到了类似的问题,我将所有Button命名都更改为新按钮,例如将button1更改为button2,然后构建并运行了它.它可能正在另一页中查看相同的按钮1?

I had a similar issue , i changed all Button naming to new button say button1 to button2 and build and ran it worked. it may be looking at the same button 1 in another page ?

这篇关于页面"analysis_aspx"不包含"Button1_Click"的定义,也没有扩展方法"Button1_Click"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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