Compilation Error At RunTime

I am attempting to bind a drop down list to query results, I thought I had everything set-up as I should, but before my page ever loads I get an error thrown. This is the error that I get

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

Here is the more detailed info:

<div class="WhiteBackgroundForDataGrids">
  <font class="BoldTextBlack">Member Names:</font>
    <asp:DropDownList runat="server" ID="ddlMembers" CssClass="DropDownLists" 
        Width="120px" onselectedindexchanged="ddlMembers_SelectedIndexChanged">
    </asp:DropDownList>

But in my C# code behind I have this (which I thought is what it's searching for)

protected void ddlMembers_OnSelectedIndexChanged(object sender, EventArgs e)
{
}

EDIT --- Even after adding the event handlers to the SelectedIndexChanged it still presents the same error.

Upvotes: 0

Views: 1457

Answers (1)

Greg
Greg

Reputation: 11478

The problem with your code behind, is the following:

protected void ddlMembers_OnSelectedIndexChanged(object sender, EventArgs e)
{

}

Since it is an Event Handler, you'll want to ensure the control can send the data and context.

Upvotes: 3

Related Questions