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 Sub ObjectListCtrl_ItemCommand(sender As Object, e As ObjectListCommandEventArgs)
If e.CommandName = "CmdDisplayDetails" Then
End If
End Sub

B.
Public Sub ObjectListCtrl_ItemCommand(sender As Object, e As ObjectListCommandEventArgs)
If e.CommandArgument.ToString() = "CmdDisplayDetails" Then
End If
End Sub

C.
Public Sub ObjectListCtrl_ItemCommand(sender As Object, e As ObjectListCommandEventArgs)
Dim cmd As ObjectListCommand = TryCast(sender, ObjectListCommand)
If cmd.Name = "CmdDisplayDetails" Then
End If
End Sub

D.
Public Sub ObjectListCtrl_ItemCommand(sender As Object, e As ObjectListCommandEventArgs)
Dim cmd As ObjectListCommand = TryCast(e.CommandSource, ObjectListCommand)
If cmd.Name = "CmdDisplayDetails" Then
End If
End Sub



Leave a Reply 0

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