PrepAway - Latest Free Exam Questions & Answers

Which code segment should you insert at line 02?

You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You create a Web form and add the following code fragment.

<asp:Repeater ID="rptData" runat="server" DataSourceID="SqlDataSource1"ItemDataBound="rptData_ItemDataBound">
<ItemTemplate>
<asp:Label ID="lblQuantity" runat="server" Text='<%# Eval("QuantityOnHand") %>’ />
</ItemTemplate>
</asp:Repeater>
The SqlDataSource1 DataSource control retrieves the Quantity column values from a table named Products.
You write the following code segment to create the rptData_ItemDataBound event handler.
(Line numbers are included for reference only.)

01 Protected Sub rptData_ItemDataBound(sender As Object, e As RepeaterItemEventArgs)
02
03 If lbl IsNot Nothing Then
04 If Integer.Parse(lbl.Text) < 10 Then
05 lbl.ForeColor = Color.Red
06 End If
07 End If
08 End Sub

You need to retrieve a reference to the lblQuantity Label control into a variable named lbl.
Which code segment should you insert at line 02?

PrepAway - Latest Free Exam Questions & Answers

A.
Dim lbl As Label = TryCast(Page.FindControl("lblQuantity"), Label)

B.
Dim lbl As Label = TryCast(e.Item.FindControl("lblQuantity"), Label)

C.
Dim lbl As Label = TryCast(rptData.FindControl("lblQuantity"), Label)

D.
Dim lbl As Label = TryCast(e.Item.Parent.FindControl("lblQuantity"), Label)


Leave a Reply