PrepAway - Latest Free Exam Questions & Answers

Category: 70-562

Exam 70-562: TS: Microsoft .NET Framework 3.5, ASP.NET Application Development

Which code segment should you insert at line 04?

You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You create the following controls:
A composite custom control named MyControl.
A templated custom control named OrderFormData.
You write the following code segment to override the method named CreateChildControls() in the MyControl class. (Line numbers are included for reference only.)
01 Protected Overrides Sub CreateChildControls()
02 Controls.Clear()
03 Dim oFData As New OrderFormData("OrderForm")
04
05 End Sub

You need to add the OrderFormData control to the MyControl control.
Which code segment should you insert at line 04?

Which method should you add to the Web page?

You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You create two user controls named UserCtrlA.ascx and UserCtrlB.ascx. The user controls postback to the server.
You create a new Web page that has the following ASPX code.
<asp:CheckBox ID="Chk" runat="server" oncheckedchanged="Chk_CheckedChanged" AutoPostBack="true" />
<asp:PlaceHolder ID="PlHolder" runat="server"></asp:PlaceHolder>
To dynamically create the user controls, you write the following code segment for the Web page.

Public Sub LoadControls()
If ViewState("CtrlA") IsNot Nothing Then

Dim c As Control
If CBool(ViewState("CtrlA")) = True Then
c = LoadControl("UserCtrlA.ascx")
Else
c = LoadControl("UserCtrlB.ascx")
End If

c.ID = "Ctrl"
PlHolder.Controls.Add(c)
End If

End Sub

Protected Sub Chk_CheckedChanged(sender As Object, e As EventArgs)
ViewState("CtrlA") = Chk.Checked
PlHolder.Controls.Clear()
LoadControls()
End Sub

You need to ensure that the user control that is displayed meets the following requirements:
It is recreated during postback It retains its state.
Which method should you add to the Web page?

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?

Which code segment should you use?

You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You define the following class.

Public Class Product
Public Property Price() As Decimal
Get
Return m_Price
End Get
Set
m_Price = Value
End Set
End Property
Private m_Price As Decimal
End Class

Your application contains a Web form with a Label control named lblPrice.
You use a StringReader variable named xmlStream to access the following XML fragment.
<Product>
<Price>35</Price>
</Product>
You need to display the price of the product from the XML fragment in the lblPrice Label control.
Which code segment should you use?

Which override method should you use?

You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You derive a new validation control from the BaseValidator class.
The validation logic for the control is implemented in the Validate method in the following manner.

Protected Shared Function Validate(value As String) As Boolean
End Function

You need to override the method that validates the value of the related control.
Which override method should you use?

Which code segment should you use?

You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You create a custom control named OrderForm.
You write the following code segment.

Public Delegate Sub CheckOrderFormEventHandler(e As EventArgs)
Private Shared ReadOnly CheckOrderFormKey As New Object()
Public Custom Event CheckOrderForm As CheckOrderFormEventHandler
AddHandler(ByVal value As CheckOrderFormEventHandler)
Events.[AddHandler](CheckOrderFormKey, value)
End AddHandler
RemoveHandler(ByVal value As CheckOrderFormEventHandler)
Events.[RemoveHandler](CheckOrderFormKey, value)
End RemoveHandler
End Event

You need to provide a method that enables the OrderForm control to raise the CheckOrderForm event.
Which code segment should you use?


Page 8 of 8« First...45678