“does not contain a definition for ...and no extension method ...accepting a first argument for type error
<p>I've got the following error:</p>

<pre><code>'DirectActivity' does not contain a definition for 'ddl_jobcode_Id2' and no extension method 'ddl_jobcode_Id2' accepting a first argument of type 'DirectActivity' could be found (are you missing a using directive or an assembly reference?)
</code></pre>

<p>In my aspx, I created a DropDownList like this:</p>

<pre><code>&lt;asp:DropDownList ID="ddl_jobcode_Id2" runat="server" DataSourceID="ddl_ActivityType2"
                            DataTextField="jobCode" DataValueField="ID" SelectedValue='&lt;%# Bind("jobCode_ID2", "{0}") %&gt;'
                            OnDataBound="ddl_jobcode_Id2_DataBound" 
                            onselectedindexchanged="ddl_jobcode_Id2_SelectedIndexChanged1" 
                            AutoPostBack="True"&gt;
                        &lt;/asp:DropDownList&gt;
</code></pre>

<p>I need to add a control so that in the .cs file I worte </p>

<pre><code>protected void ddl_jobcode_Id2_SelectedIndexChanged1(object sender, EventArgs e)
{
    if(this.ddl_jobcode_Id2.SelectedValue == "19" )
     {  ...}}
</code></pre>

<p>and it just shows this error on <code>ddl_jobcode_Id2</code></p>

<p>could anyone help me please? many thanks!!!</p>
