title: Could not find Control in ControlParameter inside EditItemTemplate
body: <p>I am working on a Dynamic Data website and I have run into a wall. I have a Details page where the details for each employee can be seen, and then I have a separate page to edit each employee. I did this because I need to use DropDownList boxes for Department and Job in each department. Nevertheless, I am having trouble accessing the department ddl and I think it is because it is inside an EditItemTemplate. Here is what I have:</p>
  
  <pre><code>&lt;asp:DetailsView ID="dvEmployee" 
                      DataSourceID="EmpDVds" 
                      AutoGenerateRows="false" 
                      DataKeyNames="Id" 
                      GridLines="None" 
                      CellSpacing="10" 
                      runat="server" DefaultMode="Edit"&gt;
                      &lt;Fields&gt;
                          &lt;asp:TemplateField HeaderStyle-Font-Bold="true" HeaderText="Department: "&gt;
                              &lt;EditItemTemplate&gt;
                                  &lt;asp:DropDownList ID="ddlDept" DataSourceID="DeptDDLds" DataTextField = "DepartmentName" DataValueField = "Id" runat="server" SelectedValue='&lt;%#Bind("DeptID") %&gt;' /&gt;
                              &lt;/EditItemTemplate&gt;
                          &lt;/asp:TemplateField&gt;
                          &lt;asp:TemplateField HeaderStyle-Font-Bold="true" HeaderText="Job Code: "&gt;
                              &lt;EditItemTemplate&gt;
                                  &lt;asp:DropDownList ID="ddlJob" DataSourceID="JobDDLds" DataTextField = "JobName" DataValueField = "Id" runat="server" /&gt;
                              &lt;/EditItemTemplate&gt;
                          &lt;/asp:TemplateField&gt;
                      &lt;/Fields&gt;
  </code></pre>
  
  <p>Then I am trying to use the ddlDept SelectedValue to populate the ddlJob. Here is the DataSource I am trying to use. </p>
  
  <pre><code>&lt;asp:SqlDataSource ID="JobDDLds"
                      SelectCommand="
                          SELECT 
                          Id, 
                          Code+' - '+[Desc] AS JobName,
                          Department_Id 
                          FROM 
                          JobCodes 
                          WHERE
                          JobCodes.Department_Id = @DeptID"
                      ConnectionString="&lt;%$ConnectionStrings:TrainingDatabaseConnection %&gt;" runat="server" &gt;
                          &lt;SelectParameters&gt;
                              &lt;asp:ControlParameter ControlID="ddlDept" PropertyName="SelectedValue"
                                      Name="DeptID" Type="Int32" /&gt;
                          &lt;/SelectParameters&gt;
                      &lt;/asp:SqlDataSource&gt;
  </code></pre>
  
  <p>I know that the format of the Select parameter is correct because I am using another ddl to populate the DetailsView and I know the relationship between Departments and JobCodes is correct because I am using it successfully in and AddEmployee page. </p>
  
  <p>Here is the error I get:</p>
  
  <p>Could not find control 'ddlDept' in ControlParameter 'DeptID'.</p>
  
  <p>I am I correct in assuming that it cannot access the ddlDept by it's ID because it is in the EditItemTemplate? How can I fix this? Other suggestions on how to achieve this? Any and all help is greatly appreciated.</p>