Which code segment should you write?

You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
The application has a mobile Web form that contains the following ObjectList control.

<mobile:ObjectList ID=”ObjectListCtrl” OnItemCommand=”ObjectListCtrl_ItemCommand” Runat=”server”>
<Command Name=”CmdDisplayDetails” Text=”Details” />
<Command Name=”CmdRemove” Text=”Remove” />
</mobile:ObjectList>

You create an event handler named ObjectListCtrl_ItemCommand.

You need to ensure that the ObjectListCtrl_ItemCommand handler detects the selection of the CmdDisplayDetails item.

Which code segment should you write?

You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
The application has a mobile Web form that contains the following ObjectList control.

<mobile:ObjectList ID=”ObjectListCtrl” OnItemCommand=”ObjectListCtrl_ItemCommand” Runat=”server”>
<Command Name=”CmdDisplayDetails” Text=”Details” />
<Command Name=”CmdRemove” Text=”Remove” />
</mobile:ObjectList>

You create an event handler named ObjectListCtrl_ItemCommand.

You need to ensure that the ObjectListCtrl_ItemCommand handler detects the selection of the CmdDisplayDetails item.

Which code segment should you write?

A.
public void ObjectListCtrl_ItemCommand( object sender, ObjectListCommandEventArgs e) {
if (e.CommandName == “CmdDisplayDetails”) { }
}

B.
public void ObjectListCtrl_ItemCommand( object sender, ObjectListCommandEventArgs e) {
if (e.CommandArgument.ToString() == “CmdDisplayDetails”) { }
}

C.
public void ObjectListCtrl_ItemCommand( object sender, ObjectListCommandEventArgs e) {
ObjectListCommand cmd = sender as ObjectListCommand;
if (cmd.Name == “CmdDisplayDetails”) { }
}

D.
public void ObjectListCtrl_ItemCommand( object sender, ObjectListCommandEventArgs e) {
ObjectListCommand cmd = e.CommandSource as ObjectListCommand;
if (cmd.Name == “CmdDisplayDetails”) { }
}



Leave a Reply 0

Your email address will not be published. Required fields are marked *