我有这个下拉列表:
<asp:DropDownList runat="server" ID="CatsList" AutoPostBack="True" AppendDataBoundItems="True" DataSourceID="CatsDataSource" DataTextField="CatName" DataValueField="CatId" ClientIDMode="Static" OnSelectedIndexChanged="CatsList_SelectedIndexChanged" OnDataBound="CatsList_DataBound">
<asp:ListItem Value="1">* SELECT CATEGORY *</asp:ListItem>
</asp:DropDownList>
这在我的本地机器上运行完美,但是当我将它上传到服务器时出现了这个错误:
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.categorybrands_aspx' does not contain a definition for 'CatsList_SelectedIndexChanged' and no extension method 'CatsList_SelectedIndexChanged' accepting a first argument of type 'ASP.categorybrands_aspx' could be found (are you missing a using directive or an assembly reference?)
Source Error:
Line 24: <div class="service span3" style="background-color:#fff;border:none;margin-bottom:0px;padding-bottom:0px;">
Line 25: <h4 style="color:#ff6a00;font-family:Corbel;">Category</h4>
Line 26: <asp:DropDownList runat="server" ID="CatsList" AutoPostBack="True" AppendDataBoundItems="True" DataSourceID="CatsDataSource" DataTextField="CatName" DataValueField="CatId" ClientIDMode="Static" OnSelectedIndexChanged="CatsList_SelectedIndexChanged" OnDataBound="CatsList_DataBound">
Line 27: <asp:ListItem Value="1">* SELECT CATEGORY *</asp:ListItem>
Line 28: </asp:DropDownList>
我的 .cs 文件中有 CatsList_SelectedIndexChanged
方法,我真的不明白这个错误!
最佳答案
好吧,这是一个愚蠢的错误,但我想出了一个简单的解决方案!!
- 我清理了我的解决方案。
- 再次重建
- 重新上传应用。到服务器。
它现在正在工作。
关于c# - 错误 : DropdownList server error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20688202/