简体   繁体   中英

error: DropdownList server error

I have this dropdownlist:

<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>

which is working perfect on my local machine, but when I upload it to the server I got this error:

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>

I have method for CatsList_SelectedIndexChanged in my .cs file, really I don't understand the error!

Well, it's a silly error but I figured out the solution which is simple!!

  1. I cleaned my solution.
  2. Rebuild again
  3. Re-upload the app. to the server.

It is working now.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM