13
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:
<asp:DetailsView ID="dvEmployee"
DataSourceID="EmpDVds"
AutoGenerateRows="false"
DataKeyNames="Id"
GridLines="None"
CellSpacing="10"
runat="server" DefaultMode="Edit">
<Fields>
<asp:TemplateField HeaderStyle-Font-Bold="true" HeaderText="Department: ">
<EditItemTemplate>
<asp:DropDownList ID="ddlDept" DataSourceID="DeptDDLds" DataTextField = "DepartmentName" DataValueField = "Id" runat="server" SelectedValue='<%#Bind("DeptID") %>' />
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderStyle-Font-Bold="true" HeaderText="Job Code: ">
<EditItemTemplate>
<asp:DropDownList ID="ddlJob" DataSourceID="JobDDLds" DataTextField = "JobName" DataValueField = "Id" runat="server" />
</EditItemTemplate>
</asp:TemplateField>
</Fields>
Then I am trying to use the ddlDept SelectedValue to populate the ddlJob. Here is the DataSource I am trying to use.
<asp:SqlDataSource ID="JobDDLds"
SelectCommand="
SELECT
Id,