You are updating an ASP.NET Web Application.
The application includes the fallowing classes.
public class Supervisor
{
public string FirstName { get; set; }
public string LastName { get; set; }
public List<Employee> Employees { get; set; }
}
public class Employee
{
public String FirstName { get; set; }
public String LastName { get; set; }
}
An application page contains the fallowing markup.
<asp:Repeater ID=”rptSupervisor” runat=”server”
DataSourceID=”odsEmployees”>
<ItemTemplate>
<%#Eval(“FirstName”) %> <%#Eval(“LastName”)%>
Employees:
<asp:Repeater ID=”rptEmployees” runat=”server”>
<ItemTemplate>
<%#Eval(“FirstName”) %> <%#Eval(“LastName”) %>
</ItemTemplate>
</asp:Repeater>
</ItemTemplate>
</asp:Repeater>
<asp:ObjectDataSource ID=”odsEmployees” runat=”server” SelectMethod=”GetSupervisorWithEmployees”
TypeName=”BusinessLayer”>
</asp:ObjectDataSource>
You need to ensure that the page displays a list ofsupervisors with their corresponding employees.
What should you do?
A.
Bind rptEmployees during the OnItemCommand event of rptSupervisor.
B.
Bind rptEmployees during the OnItemDataBound event of rptEmployees.
C.
Set the rptEmployees DataSourceID attribute to “Employees”.
D.
Set the rptEmployees DataSource attribute to <%# Eval(“Employees”) %>