问题描述
运行程序时收到错误消息.我觉得这是常见的错误类型.您可以简单地解释此错误吗?
I have received an error message when I run my program. I feel this is a common type of error. Can you explain this error in simple terms.
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.searchbygenre_aspx' does not contain a definition for 'ddlGenre_SelectedIndexChanged' and no extension method 'ddlGenre_SelectedIndexChanged' accepting a first argument of type 'ASP.searchbygenre_aspx' could be found (are you missing a using directive or an assembly reference?)
Source Error:
Line 6: <p>
Line 7: Choose a Genre:
Line 8: <asp:DropDownList ID="ddlGenre" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlGenre_SelectedIndexChanged">
Line 9: </asp:DropDownList>
Line 10: </p>
Source File: c:\Users\Jithma Senarathne\Desktop\fiverr\asp.net\Project\Cinema Website\Cinema Website\Cinema Website\SearchByGenre.aspx Line: 8
推荐答案
根据错误消息,在您的首页上( c:\ Users \ Jithma Senarathne \ Desktop \ fiverr \ asp.net \ Project \ Cinema网站\电影院网站\电影院网站\ SearchByGenre.aspx
),您可能会有一个下拉列表(名为 ddlGenre
),该列表绑定到 OnSelectedIndexChanged
事件 ddlGenre_SelectedIndexChanged
,但是 SearchByGenre.aspx.cs
文件中后面的代码中没有该方法.您应该做的是:
According to the error message, in your front page (c:\Users\Jithma Senarathne\Desktop\fiverr\asp.net\Project\Cinema Website\Cinema Website\Cinema Website\SearchByGenre.aspx
), you may have a dropdownlist (named ddlGenre
) which is bound the OnSelectedIndexChanged
event ddlGenre_SelectedIndexChanged
, but there doesn't have the method in the code behind in the SearchByGenre.aspx.cs
file. What you should do is:
-
或者删除首页
SearchByGenre.aspx
第8行中的事件绑定代码:AutoPostBack ="True" OnSelectedIndexChanged ="ddlGenre_SelectedIndexChanged"
,
either remove the event binding code in front page
SearchByGenre.aspx
line 8:AutoPostBack="True" OnSelectedIndexChanged="ddlGenre_SelectedIndexChanged"
,
或在 SearchByGenre.aspx.cs
文件中后面的代码处添加事件方法.
or add the event method at code behind in the SearchByGenre.aspx.cs
file.
这篇关于得到错误“'/'应用程序中的服务器错误".当我运行程序时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!