这是什么问题~~~~~~~~~~~~~~~~~~拉长

时间:2021-06-22 20:35:29
当我添加一个按钮的时候 运行没有错误 然后双击按钮事件 运行就有错误了 为什么

21 个解决方案

#1


这是因为你按钮里的代码执行的结果有错,可以调试一下。

#2


VS坏掉了?

#3


这个问题的确是问题....

#4


先拉高














你按钮事件中的代码错了

#5


按钮删了,换个按钮

#6


重新启动VS,然后从新加个按钮,仔细简单事件里的代码

#7


主要是还要看你到底报的什么错,应该是按钮事件里的代码有问题

#8


引用 1 楼 yfqvip 的回复:
这是因为你按钮里的代码执行的结果有错,可以调试一下。


我其实是有俩个问题 一个是这个 一个是调试不能调试,当调试的时候 直接过我设置的断点 别的程序就可以
是不是我的代码上有问题了 但我没弄别的 就一步一步往下写的代码

#9


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.jihuazu_gcrwfenpei_aspx' does not contain a definition for 'Button3_Click1' and no extension method 'Button3_Click1' accepting a first argument of type 'ASP.jihuazu_gcrwfenpei_aspx' could be found (are you missing a using directive or an assembly reference?)

Source Error:

 

Line 42:                      
Line 43:                                         <input id="Button2" type="button" value="添加" onclick="return fun()" style="width:65px;" />
Line 44:                                     <asp:Button ID="Button3" runat="server" onclick="Button3_Click1" 
Line 45:                                         Text="Button" />
Line 46:                                 </TD>
 

#10


引用 9 楼 zhengweitao 的回复:
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.jihuazu_gcrwfenpei_aspx' does not contain a definition for 'Button3_Click1' and no extension method 'Button3_Click1' accepting a first argument…

意思是说没有找到Button3_Click1方法,你的页面里没有定义方法Button3_Click1。
把Button3删除之后重新拖一个,重新把代码复制进去。

#11


即使定义了,但是没有注册事件,所以就报错了。
onclick是区分大小写的。要写成OnClick

#12


我都删了N个了 换了N个按钮

不知道为什么

#13


换个按钮试试啊

#14


引用 12 楼 zhengweitao 的回复:
我都删了N个了 换了N个按钮

不知道为什么

这样啊,加上下面定义,如果有就不用加了
protected System.Web.UI.WebControls.Button Button3;
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
}
private void InitializeComponent()
{    
this.Button1.Click += new System.EventHandler(this.Button1_Click);
}

#15


引用 12 楼 zhengweitao 的回复:
我都删了N个了 换了N个按钮

不知道为什么

这样啊,加上下面定义,如果有就不用加了
protected System.Web.UI.WebControls.Button Button3;
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
}
private void InitializeComponent()
{    
this.Button3.Click += new System.EventHandler(this.Button3_Click);
}

#16


<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm5.aspx.cs" Inherits="jgmis.WebForm5" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
    </div>
    </form>
</body>
</html>

里面什么都没写 直接运行都有错误了 
Parser Error 
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. 

Parser Error Message: Could not load type 'jgmis.WebForm5'.

Source Error: 


Line 1:  <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm5.aspx.cs" Inherits="jgmis.WebForm5" %>
Line 2:  
Line 3:  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 

#17


Line 1:  <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm5.aspx.cs" Inherits="jgmis.WebForm5" %> 


把你页面上的这句中的Inherits="jgmis.WebForm5" 改为:Inherits="WebForm5"

然后,在你的ASPX.CS文件中,改为以下格式:

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class WebForm5 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

#18


顶~ 接分!不晓得是哪儿的小错误~

#19


引用 10 楼 yfqvip 的回复:
引用 9 楼 zhengweitao 的回复:
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.jihuazu_gcrwfenpei_aspx' does not contain a definition for 'Button3_Click 1' and no extension method 'Button3_C…


OnClick后面怎么会出现'1'?

#20


不行 

#21


引用 16 楼 zhengweitao 的回复:
HTML code<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm5.aspx.cs" Inherits="jgmis.WebForm5" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">…


jgmis.WebForm5 - > jgmis_WebForm5

#1


这是因为你按钮里的代码执行的结果有错,可以调试一下。

#2


VS坏掉了?

#3


这个问题的确是问题....

#4


先拉高














你按钮事件中的代码错了

#5


按钮删了,换个按钮

#6


重新启动VS,然后从新加个按钮,仔细简单事件里的代码

#7


主要是还要看你到底报的什么错,应该是按钮事件里的代码有问题

#8


引用 1 楼 yfqvip 的回复:
这是因为你按钮里的代码执行的结果有错,可以调试一下。


我其实是有俩个问题 一个是这个 一个是调试不能调试,当调试的时候 直接过我设置的断点 别的程序就可以
是不是我的代码上有问题了 但我没弄别的 就一步一步往下写的代码

#9


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.jihuazu_gcrwfenpei_aspx' does not contain a definition for 'Button3_Click1' and no extension method 'Button3_Click1' accepting a first argument of type 'ASP.jihuazu_gcrwfenpei_aspx' could be found (are you missing a using directive or an assembly reference?)

Source Error:

 

Line 42:                   &nbsp;&nbsp;&nbsp;
Line 43:                                         <input id="Button2" type="button" value="添加" onclick="return fun()" style="width:65px;" />
Line 44:                                     <asp:Button ID="Button3" runat="server" onclick="Button3_Click1" 
Line 45:                                         Text="Button" />
Line 46:                                 </TD>
 

#10


引用 9 楼 zhengweitao 的回复:
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.jihuazu_gcrwfenpei_aspx' does not contain a definition for 'Button3_Click1' and no extension method 'Button3_Click1' accepting a first argument…

意思是说没有找到Button3_Click1方法,你的页面里没有定义方法Button3_Click1。
把Button3删除之后重新拖一个,重新把代码复制进去。

#11


即使定义了,但是没有注册事件,所以就报错了。
onclick是区分大小写的。要写成OnClick

#12


我都删了N个了 换了N个按钮

不知道为什么

#13


换个按钮试试啊

#14


引用 12 楼 zhengweitao 的回复:
我都删了N个了 换了N个按钮

不知道为什么

这样啊,加上下面定义,如果有就不用加了
protected System.Web.UI.WebControls.Button Button3;
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
}
private void InitializeComponent()
{    
this.Button1.Click += new System.EventHandler(this.Button1_Click);
}

#15


引用 12 楼 zhengweitao 的回复:
我都删了N个了 换了N个按钮

不知道为什么

这样啊,加上下面定义,如果有就不用加了
protected System.Web.UI.WebControls.Button Button3;
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
}
private void InitializeComponent()
{    
this.Button3.Click += new System.EventHandler(this.Button3_Click);
}

#16


<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm5.aspx.cs" Inherits="jgmis.WebForm5" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
    </div>
    </form>
</body>
</html>

里面什么都没写 直接运行都有错误了 
Parser Error 
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. 

Parser Error Message: Could not load type 'jgmis.WebForm5'.

Source Error: 


Line 1:  <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm5.aspx.cs" Inherits="jgmis.WebForm5" %>
Line 2:  
Line 3:  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 

#17


Line 1:  <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm5.aspx.cs" Inherits="jgmis.WebForm5" %> 


把你页面上的这句中的Inherits="jgmis.WebForm5" 改为:Inherits="WebForm5"

然后,在你的ASPX.CS文件中,改为以下格式:

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class WebForm5 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

#18


顶~ 接分!不晓得是哪儿的小错误~

#19


引用 10 楼 yfqvip 的回复:
引用 9 楼 zhengweitao 的回复:
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.jihuazu_gcrwfenpei_aspx' does not contain a definition for 'Button3_Click 1' and no extension method 'Button3_C…


OnClick后面怎么会出现'1'?

#20


不行 

#21


引用 16 楼 zhengweitao 的回复:
HTML code<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm5.aspx.cs" Inherits="jgmis.WebForm5" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">…


jgmis.WebForm5 - > jgmis_WebForm5