Upload
pragya-rastogi
View
1.923
Download
3
Tags:
Embed Size (px)
DESCRIPTION
Citation preview
| English | Chinese | Japan | Korean | - 2 - Test Information Co., Ltd. All rights reserved.
1. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You create a Web page that contains the following two XML fragments. (Line numbers are included for
reference only.)
01
02
03
04
08
09
10
12
13
The SqlDataSource1 object retrieves the data from a Microsoft SQL Server 2005 database table. The
database table has a column named LineTotal.
You need to ensure that when the size of the LineTotal column value is greater than seven characters, the
column is displayed in red color.
What should you do?
A. Insert the following code segment at line 06.
OnItemDataBound="FmtClr"
Insert the following code segment at line 02.
protected void FmtClr
(object sender, ListViewItemEventArgs e)
{
Label LineTotal = (Label)
e.Item.FindControl("LineTotalLabel");
| English | Chinese | Japan | Korean | - 3 - Test Information Co., Ltd. All rights reserved.
if ( LineTotal.Text.Length > 7)
{ LineTotal.ForeColor = Color.Red; }
else
{LineTotal.ForeColor = Color.Black; }
}
B. Insert the following code segment at line 06.
OnItemDataBound="FmtClr"
Insert the following code segment at line 02.
protected void FmtClr
(object sender, ListViewItemEventArgs e)
{
Label LineTotal = (Label)
e.Item.FindControl("LineTotal");
if ( LineTotal.Text.Length > 7)
{LineTotal.ForeColor = Color.Red; }
else
{LineTotal.ForeColor = Color.Black; }
}
C. Insert the following code segment at line 06.
OnDataBinding="FmtClr"
Insert the following code segment at line 02.
protected void FmtClr(object sender, EventArgs e)
{
Label LineTotal = new Label();
LineTotal.ID = "LineTotal";
if ( LineTotal.Text.Length > 7)
{LineTotal.ForeColor = Color.Red; }
else
{ LineTotal.ForeColor = Color.Black; }
| English | Chinese | Japan | Korean | - 4 - Test Information Co., Ltd. All rights reserved.
}
D. Insert the following code segment at line 06.
OnDataBound="FmtClr"
Insert the following code segment at line 02.
protected void FmtClr(object sender, EventArgs e)
{
Label LineTotal = new Label();
LineTotal.ID = "LineTotalLabel";
if ( LineTotal.Text.Length > 7)
{LineTotal.ForeColor = Color.Red; }
else
{LineTotal.ForeColor = Color.Black; }
}
Answer: A
2. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You create a Web page that contains the following two XML fragments. (Line numbers are included for
reference only.)
01
02
03
04
08
09
10
| English | Chinese | Japan | Korean | - 5 - Test Information Co., Ltd. All rights reserved.
12
13
The SqlDataSource1 object retrieves the data from a Microsoft SQL Server 2005 database table. The
database table has a column named LineTotal.
You need to ensure that when the size of the LineTotal column value is greater than seven characters, the
column is displayed in red color.
What should you do?
A. Insert the following code segment at line 06.
OnItemDataBound="FmtClr"
Insert the following code segment at line 02.
Protected Sub FmtClr(ByVal sender As Object, _ByVal e As ListViewItemEventArgs)
Dim LineTotal As Label = _
DirectCast(e.Item.FindControl("LineTotalLabel"), Label)
If LineTotal IsNot Nothing Then
If LineTotal.Text.Length > 7 Then
LineTotal.ForeColor = Color.Red
Else
LineTotal.ForeColor = Color.Black
End If
End If
End Sub
B. Insert the following code segment at line 06.
OnItemDataBound="FmtClr"
Insert the following code segment at line 02.
Protected Sub FmtClr(ByVal sender As Object, _ByVal e As ListViewItemEventArgs)
Dim LineTotal As Label = _
DirectCast(e.Item.FindControl("LineTotal"), Label)
If LineTotal.Text.Length > 7 Then
LineTotal.ForeColor = Color.Red
| English | Chinese | Japan | Korean | - 6 - Test Information Co., Ltd. All rights reserved.
Else
LineTotal.ForeColor = Color.Black
End If
End Sub
C. Insert the following code segment at line 06.
OnDataBinding="FmtClr"
Insert the following code segment at line 02.
Protected Sub FmtClr(ByVal sender As Object, _ByVal e As EventArgs)
Dim LineTotal As New Label()
LineTotal.ID = "LineTotal"
If LineTotal.Text.Length > 7 Then
LineTotal.ForeColor = Color.Red
Else
LineTotal.ForeColor = Color.Black
End If
End Sub
D. Insert the following code segment at line 06.
OnDataBound="FmtClr"
Insert the following code segment at line 02.
Protected Sub FmtClr(ByVal sender As Object, _ByVal e As EventArgs)
Dim LineTotal As New Label()
LineTotal.ID = "LineTotalLabel"
If LineTotal.Text.Length > 7 Then
LineTotal.ForeColor = Color.Red
Else
LineTotal.ForeColor = Color.Black
End If
End Sub
Answer: A
| English | Chinese | Japan | Korean | - 7 - Test Information Co., Ltd. All rights reserved.
3. 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.
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 void rptData_ItemDataBound(object sender,
02 RepeaterItemEventArgs e)
03 {
04
05 if(lbl != null)
06 if(int.Parse(lbl.Text) < 10)
07 lbl.ForeColor = Color.Red;
08 }
You need to retrieve a reference to the lblQuantity Label control into a variable named lbl.
Which code segment should you insert at line 04?
A. Label lbl = Page.FindControl("lblQuantity") as Label;
B. Label lbl = e.Item.FindControl("lblQuantity") as Label;
C. Label lbl = rptData.FindControl("lblQuantity") as Label;
D. Label lbl = e.Item.Parent.FindControl("lblQuantity") as Label;
Answer: B
| English | Chinese | Japan | Korean | - 8 - Test Information Co., Ltd. All rights reserved.
4.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.
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(ByVal sender As Object, _
02 ByVal e As RepeaterItemEventArgs)
03
04 If lbl IsNot Nothing Then
05 If Integer.Parse(lbl.Text) < 10 Then
06 lbl.ForeColor = Color.Red
07 End If
08 End If
09 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 03?
A. Dim lbl As Label = _
TryCast(Page.FindControl("lblQuantity"), Label)
B. Dim lbl As Label = _
| English | Chinese | Japan | Korean | - 9 - Test Information Co., Ltd. All rights reserved.
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)
Answer: B
5. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
Your application has a user control named UserCtrl.ascx. You write the following code fragment to create
a Web page named Default.aspx.
...
You need to dynamically add the UserCtrl.ascx control between the lblHeader and lblFooter Label
controls.
What should you do?
A. Write the following code segment in the Init event of the Default.aspx Web page.
Control ctrl = LoadControl("UserCtrl.ascx");
this.Controls.AddAt(1, ctrl);
| English | Chinese | Japan | Korean | - 10 - Test Information Co., Ltd. All rights reserved.
B. Write the following code segment in the Init event of the Default.aspx Web page.
Control ctrl = LoadControl("UserCtrl.ascx");
lblHeader.Controls.Add(ctrl);
C. Add a Literal control named Ltrl between the lblHeader and lblFooter label controls.
Write the following code segment in the Init event of the Default.aspx Web page.
Control ctrl = LoadControl("UserCtrl.ascx");
D. Add a PlaceHolder control named PlHldr between the lblHeader and lblFooter label controls.
Write the following code segment in the Init event of the Default.aspx Web page.
Control ctrl = LoadControl("UserCtrl.ascx");
PlHldr.Controls.Add(ctrl);
Answer: D
6. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
Your application has a user control named UserCtrl.ascx. You write the following code fragment to create
a Web page named Default.aspx.
...
You need to dynamically add the UserCtrl.ascx control between the lblHeader and lblFooter Label
| English | Chinese | Japan | Korean | - 11 - Test Information Co., Ltd. All rights reserved.
controls.
What should you do?
A. Write the following code segment in the Init event of the Default.aspx Web page.
Dim ctrl As Control = LoadControl("UserCtrl.ascx")
Me.Controls.AddAt(1, ctrl)
B. Write the following code segment in the Init event of the Default.aspx Web page.
Dim ctrl As Control = LoadControl("UserCtrl.ascx")
lblHeader.Controls.Add(ctrl)
C. Add a Literal control named Ltrl between the lblHeader and lblFooter label controls.
Write the following code segment in the Init event of the Default.aspx Web page.
Dim ctrl As Control = LoadControl("UserCtrl.ascx")
D. Add a PlaceHolder control named PlHldr between the lblHeader and lblFooter label controls.
Write the following code segment in the Init event of the Default.aspx Web page.
Dim ctrl As Control = LoadControl("UserCtrl.ascx")
PlHldr.Controls.Add(ctrl)
Answer: D
7. 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.
To dynamically create the user controls, you write the following code segment for the Web page.
public void LoadControls()
{
if (ViewState["CtrlA"] != null)
{
| English | Chinese | Japan | Korean | - 12 - Test Information Co., Ltd. All rights reserved.
Control c;
if ((bool)ViewState["CtrlA"] == true)
{ c = LoadControl("UserCtrlA.ascx"); }
else
{ c = LoadControl("UserCtrlB.ascx"); }
c.ID = "Ctrl";
PlHolder.Controls.Add(c);
}
}
protected void Chk_CheckedChanged(object sender, EventArgs e)
{
ViewState["CtrlA"] = Chk.Checked;
PlHolder.Controls.Clear();
LoadControls();
}
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?
A. protected override object SaveViewState()
{
LoadControls();
return base.SaveViewState();
}
B. protected override void Render(HtmlTextWriter writer)
{
LoadControls();
base.Render(writer);
}
| English | Chinese | Japan | Korean | - 13 - Test Information Co., Ltd. All rights reserved.
C. protected override void OnLoadComplete(EventArgs e)
{
base.OnLoadComplete(e);
LoadControls();
}
D. protected override void LoadViewState(object savedState)
{
base.LoadViewState(savedState);
LoadControls();
}
Answer: D
8. 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.
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"
| English | Chinese | Japan | Korean | - 14 - Test Information Co., Ltd. All rights reserved.
PlHolder.Controls.Add(c)
End If
End Sub
Protected Sub Chk_CheckedChanged(ByVal sender As Object, _
ByVal 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?
A. Protected Overloads Overrides Function _
SaveViewState() As Object
LoadControls()
Return MyBase.SaveViewState()
End Function
B. Protected Overloads Overrides _
Sub Render(ByVal writer As HtmlTextWriter)
LoadControls()
MyBase.Render(writer)
End Sub
C. Protected Overloads Overrides Sub _
OnLoadComplete(ByVal e As EventArgs)
MyBase.OnLoadComplete(e)
LoadControls()
End Sub
D. Protected Overloads Overrides Sub _
| English | Chinese | Japan | Korean | - 15 - Test Information Co., Ltd. All rights reserved.
LoadViewState(ByVal savedState As Object)
MyBase.LoadViewState(savedState)
LoadControls()
End Sub
Answer: D
9. 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 override void
02 CreateChildControls() {
03 Controls.Clear();
04 OrderFormData oFData = new
05 ?OrderFormData("OrderForm");
06
07 }
You need to add the OrderFormData control to the MyControl control.
Which code segment should you insert at line 06?
A. Controls.Add(oFData);
B. Template.InstantiateIn(this);
Template.InstantiateIn(oFData);
C. Controls.Add(oFData);
this.Controls.Add(oFData);
D. this.TemplateControl = (TemplateControl)Template;
oFData.TemplateControl = (TemplateControl)Template;
Controls.Add(oFData);
| English | Chinese | Japan | Korean | - 16 - Test Information Co., Ltd. All rights reserved.
Answer: B
10. 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 Overloads 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?
A. Controls.Add(oFData)
B. Template.InstantiateIn(Me)
Template.InstantiateIn(oFData)
C. Controls.Add(oFData)
Me.Controls.Add(oFData)
D. Me.TemplateControl = DirectCast(Template, TemplateControl)
oFData.TemplateControl = DirectCast(Template, TemplateControl)
Controls.Add(oFData)
Answer: B
11. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You create a composite custom control named MyControl.
You need to add an instance of the OrderFormData control to the MyControl control.
Which code segment should you use?
| English | Chinese | Japan | Korean | - 17 - Test Information Co., Ltd. All rights reserved.
A. protected override void CreateChildControls() {
Controls.Clear();
OrderFormData oFData = new OrderFormData("OrderForm");
Controls.Add(oFData);
}
B. protected override void
RenderContents(HtmlTextWriter writer) {
OrderFormData oFData = new OrderFormData("OrderForm");
oFData.RenderControl(writer);
}
C. protected override void EnsureChildControls() {
Controls.Clear();
OrderFormData oFData = new OrderFormData("OrderForm");
oFData.EnsureChildControls();
if (!ChildControlsCreated)
CreateChildControls();
}
D. protected override ControlCollection
CreateControlCollection() {
ControlCollection controls = new ControlCollection(this);
OrderFormData oFData = new OrderFormData("OrderForm");
controls.Add(oFData);
return controls;
}
Answer: A
12. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You create a composite custom control named MyControl.
You need to add an instance of the OrderFormData control to the MyControl control.
| English | Chinese | Japan | Korean | - 18 - Test Information Co., Ltd. All rights reserved.
Which code segment should you use?
A. Protected Overloads Overrides Sub _
CreateChildControls()
Controls.Clear()
Dim oFData As New OrderFormData("OrderForm")
Controls.Add(oFData)
End Sub
B. Protected Overloads Overrides Sub _
RenderContents(ByVal writer As HtmlTextWriter)
Dim oFData As New OrderFormData("OrderForm")
oFData.RenderControl(writer)
End Sub
C. Protected Overloads Overrides Sub _
EnsureChildControls()
Controls.Clear()
Dim oFData As New OrderFormData("OrderForm")
oFData.EnsureChildControls()
If Not ChildControlsCreated Then
CreateChildControls()
End If
End Sub
D. Protected Overloads Overrides Function _
CreateControlCollection() As ControlCollection
Dim controls As New ControlCollection(Me)
Dim oFData As New OrderFormData("OrderForm")
controls.Add(oFData)
Return controls
End Function
Answer: A
| English | Chinese | Japan | Korean | - 19 - Test Information Co., Ltd. All rights reserved.
13.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 void
CheckOrderFormEventHandler(EventArgs e);
private static readonly object CheckOrderFormKey
= new object();
public event CheckOrderFormEventHandler
CheckOrderForm {
add {
Events.AddHandler(CheckOrderFormKey, value);
}
remove {
Events.RemoveHandler(CheckOrderFormKey,
value);
}
}
You need to provide a method that enables the OrderForm control to raise the CheckOrderForm event.
Which code segment should you use?
A. protected virtual void OnCheckOrderForm(EventArgs e) {
CheckOrderFormEventHandler checkOrderForm =
(CheckOrderFormEventHandler)Events[
typeof(CheckOrderFormEventHandler)];
if (checkOrderForm != null)
checkOrderForm(e);
}
B. protected virtual void OnCheckOrderForm(EventArgs e) {
CheckOrderFormEventHandler checkOrderForm =
| English | Chinese | Japan | Korean | - 20 - Test Information Co., Ltd. All rights reserved.
Events[CheckOrderFormKey] as CheckOrderFormEventHandler;
if (checkOrderForm != null)
checkOrderForm(e);
}
C. CheckOrderFormEventHandler checkOrderForm =
new CheckOrderFormEventHandler(checkOrderFormCallBack);
protected virtual void OnCheckOrderForm(EventArgs e) {
if (checkOrderForm != null)
checkOrderForm(e);
}
D. CheckOrderFormEventHandler checkOrderForm =
new CheckOrderFormEventHandler(checkOrderFormCallBack);
protected virtual void OnCheckOrderForm(EventArgs e) {
if (checkOrderForm != null)
RaiseBubbleEvent(checkOrderForm, e);
}
Answer: B
14. 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(ByVal e As EventArgs)
Private Shared ReadOnly CheckOrderFormKey As New Object()
public event CheckOrderFormEventHandler
Public Custom Event CheckOrderForm As CheckOrderFormEventHandler
AddHandler(ByVal value As CheckOrderFormEventHandler)
Events.[AddHandler](CheckOrderFormKey, value)
End AddHandler
| English | Chinese | Japan | Korean | - 21 - Test Information Co., Ltd. All rights reserved.
RemoveHandler(ByVal value As CheckOrderFormEventHandler)
Events.[RemoveHandler](CheckOrderFormKey, value)
End RemoveHandler
RaiseEvent(ByVal e As EventArgs)
End RaiseEvent
End Event
You need to provide a method that enables the OrderForm control to raise the CheckOrderForm event.
Which code segment should you use?
A. Protected Overridable Sub _
OnCheckOrderForm(ByVal e As EventArgs)
Dim checkOrderForm As CheckOrderFormEventHandler = _
DirectCast(Events(GetType(CheckOrderFormEventHandler)), _
CheckOrderFormEventHandler)
RaiseEvent CheckOrderForm(e)
End Sub
B. Protected Overridable Sub _
OnCheckOrderForm(ByVal e As EventArgs)
Dim checkOrderForm As CheckOrderFormEventHandler = _
TryCast(Events(CheckOrderFormKey), _
CheckOrderFormEventHandler)
RaiseEvent CheckOrderForm(e)
End Sub
C. Private checkOrderForm As New _
CheckOrderFormEventHandler(AddressOf _
checkOrderFormCallBack)
Protected Overridable Sub _
OnCheckOrderForm(ByVal e As EventArgs)
If checkOrderForm IsNot Nothing Then
checkOrderForm(e)
| English | Chinese | Japan | Korean | - 22 - Test Information Co., Ltd. All rights reserved.
End If
End Sub
D. Private checkOrderForm As New _
CheckOrderFormEventHandler(AddressOf _
checkOrderFormCallBack)
Protected Overridable Sub _
OnCheckOrderForm(ByVal e As EventArgs)
If checkOrderForm IsNot Nothing Then
RaiseBubbleEvent(checkOrderForm, e)
End If
End Sub
Answer: B
15. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You add a TextBox control named TextBox1.
You write the following code segment for validation.
protected void CustomValidator1_ServerValidate(
object source, ServerValidateEventArgs args) {
DateTime dt = String.IsNullOrEmpty(args.Value)
DateTime.Now : Convert.ToDateTime(args.Value);
args.IsValid = (DateTime.Now - dt).Days < 10;
}
You need to validate the value of TextBox1.
Which code fragment should you add to the Web page?
A.
B.
| English | Chinese | Japan | Korean | - 23 - Test Information Co., Ltd. All rights reserved.
runat="server"ControlToValidate="TextBox1"
InitialValue="" >
C.
D.
E.
F.
G.
H.
Answer: B
16. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You add a TextBox control named TextBox1.
You write the following code segment for validation.
Protected Sub _
| English | Chinese | Japan | Korean | - 24 - Test Information Co., Ltd. All rights reserved.
CustomValidator1_ServerValidate(ByVal source As Object, _
ByVal args As ServerValidateEventArgs)
Dim dt As DateTime = _
IIf([String].IsNullOrEmpty(args.Value), _
DateTime.Now, Convert.ToDateTime(args.Value))
args.IsValid = (DateTime.Now - dt).Days < 10
End Sub
You need to validate the value of TextBox1.
Which code fragment should you add to the Web page?
A.
B.
C.
D.
E.
F.
| English | Chinese | Japan | Korean | - 25 - Test Information Co., Ltd. All rights reserved.
ControlToValidate="TextBox1" EnableClientScript="false" InitialValue="" >
G.
H.
Answer: B
17. 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 static bool Validate(string value) {
...
}
You need to override the method that validates the value of the related control.
Which override method should you use?
A. protected override bool EvaluateIsValid() {
string value = GetControlValidationValue(
this.Attributes["AssociatedControl"]);
bool isValid = Validate(value);
return isValid;
}
B. protected override bool ControlPropertiesValid() {
string value =
GetControlValidationValue(this.ValidationGroup);
bool isValid = Validate(value);
return isValid;
| English | Chinese | Japan | Korean | - 26 - Test Information Co., Ltd. All rights reserved.
}
C. protected override bool EvaluateIsValid() {
string value =
GetControlValidationValue(this.ControlToValidate);
bool isValid = Validate(value);
return isValid;
}
D. protected override bool ControlPropertiesValid() {
string value = GetControlValidationValue(
this.Attributes["ControlToValidate"]);
bool isValid = Validate(value);
this.PropertiesValid = isValid;
return true;
}
Answer: C
18. 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 Overloads Function Validate( _
ByVal 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?
A. Protected Overloads Overrides Function EvaluateIsValid() As Boolean
Dim value As String = _
GetControlValidationValue(Me.Attributes("AssociatedControl"))
Dim isValid As Boolean = Validate(value)
| English | Chinese | Japan | Korean | - 27 - Test Information Co., Ltd. All rights reserved.
Return isValid
End Function
B. Protected Overloads Overrides _
Function ControlPropertiesValid() As Boolean
Dim value As String = _
GetControlValidationValue(Me.ValidationGroup)
Dim isValid As Boolean = Validate(value)
Return isValid
End Function
C. Protected Overloads Overrides Function EvaluateIsValid() As Boolean
Dim value As String = _
GetControlValidationValue(Me.ControlToValidate)
Dim isValid As Boolean = Validate(value)
Return isValid
End Function
D. Protected Overloads Overrides Function ControlPropertiesValid() As Boolean
Dim value As String = _
GetControlValidationValue(Me.Attributes("ControlToValidate"))
Dim isValid As Boolean = Validate(value)
Me.PropertiesValid = isValid
Return True
End Function
Answer: C
19. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You add an XmlDataSource control named XmlDataSource1 to the Web page. XmlDataSource1 is bound
to an XML document with the following structure.
| English | Chinese | Japan | Korean | - 28 - Test Information Co., Ltd. All rights reserved.
...
You also write the following code segment in the code-behind file of the Web page.
protected void BulletedList1_Click(
?object sender, BulletedListEventArgs e) {
//...
}
You need to add a BulletedList control named BulletedList1 to the Web page that is bound to
XmlDataSource1.
Which code fragment should you use?
A.
B.
C.
D.
| English | Chinese | Japan | Korean | - 29 - Test Information Co., Ltd. All rights reserved.
DataTextField="ID" DataValueField="Name"
onclick="BulletedList1_Click">
Answer: C
20. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You add an XmlDataSource control named XmlDataSource1 to the Web page. XmlDataSource1 is bound
to an XML document with the following structure.
...
You also write the following code segment in the code-behind file of the Web page.
Protected Sub BulletedList1_Click(ByVal sender As _
?Object, ByVal e As BulletedListEventArgs)
'...
End Sub
You need to add a BulletedList control named BulletedList1 to the Web page that is bound to
XmlDataSource1.
Which code fragment should you use?
A.
B.
| English | Chinese | Japan | Korean | - 30 - Test Information Co., Ltd. All rights reserved.
DataTextField="Name" DataMember="ID"
onclick="BulletedList1_Click">
C.
D.
Answer: C
21. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You write the following code fragment.
You need to ensure that when you click the Button1 control, a selected list of items move from the
ListBox1 control to the ListBox2 control.
Which code segment should you use?
A. foreach (ListItem li in ListBox1.Items) {
if (li.Selected) {
| English | Chinese | Japan | Korean | - 31 - Test Information Co., Ltd. All rights reserved.
ListBox2.Items.Add(li);
ListBox1.Items.Remove(li);
}
}
B. foreach (ListItem li in ListBox1.Items) {
if (li.Selected) {
li.Selected = false;
ListBox2.Items.Add(li);
ListBox1.Items.Remove(li);
}
}
C. foreach (ListItem li in ListBox1.Items) {
if (li.Selected) {
li.Selected = false;
ListBox2.Items.Add(li);
}
}
D. foreach (ListItem li in ListBox2.Items) {
if (ListBox1.Items.Contains(li))
ListBox1.Items.Remove(li);
}
E. foreach (ListItem li in ListBox1.Items) {
if (li.Selected) {
li.Selected = false;
ListBox2.Items.Add(li);
}
}
F. foreach (ListItem li in ListBox1.Items) {
if (ListBox2.Items.Contains(li))
| English | Chinese | Japan | Korean | - 32 - Test Information Co., Ltd. All rights reserved.
ListBox1.Items.Remove(li);
}
Answer: C
22. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You write the following code fragment.
You need to ensure that when you click the Button1 control, a selected list of items move from the
ListBox1 control to the ListBox2 control.
Which code segment should you use?
A. For Each li As ListItem In ListBox1.Items
If li.Selected Then
ListBox2.Items.Add(li)
ListBox1.Items.Remove(li)
End If
Next
B. For Each li As ListItem In ListBox1.Items
If li.Selected Then
li.Selected = False
ListBox2.Items.Add(li)
ListBox1.Items.Remove(li)
End If
Next
| English | Chinese | Japan | Korean | - 33 - Test Information Co., Ltd. All rights reserved.
C. For Each li As ListItem In ListBox1.Items
If li.Selected Then
li.Selected = False
ListBox2.Items.Add(li)
End If
Next
D. For Each li As ListItem In ListBox2.Items
If ListBox1.Items.Contains(li) Then
ListBox1.Items.Remove(li)
End If
Next
E. For Each li As ListItem In ListBox1.Items
If li.Selected Then
li.Selected = False
ListBox2.Items.Add(li)
End If
Next
F. For Each li As ListItem In ListBox1.Items
If ListBox2.Items.Contains(li) Then
ListBox1.Items.Remove(li)
End If
Next
Answer: C
23. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You write the following code fragment.
| English | Chinese | Japan | Korean | - 34 - Test Information Co., Ltd. All rights reserved.
?"DropDownList1_SelectedIndexChanged">
1
2
3
You also add a MultiView control named MultiView1 to the Web page. MultiView1 has three child View
controls.
You need to ensure that you can select the View controls by using the DropDownList1 DropDownList
control.
Which code segment should you use?
A. int idx = DropDownList1.SelectedIndex;
MultiView1.ActiveViewIndex = idx;
B. int idx = DropDownList1.SelectedIndex;
MultiView1.Views[idx].Visible = true;
C. int idx = int.Parse(DropDownList1.SelectedValue);
MultiView1.ActiveViewIndex = idx;
D. int idx = int.Parse(DropDownList1.SelectedValue);
MultiView1.Views[idx].Visible = true;
Answer: A
24. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You write the following code fragment.
1
2
3
| English | Chinese | Japan | Korean | - 35 - Test Information Co., Ltd. All rights reserved.
You also add a MultiView control named MultiView1 to the Web page. MultiView1 has three child View
controls.
You need to ensure that you can select the View controls by using the DropDownList1 DropDownList
control.
Which code segment should you use?
A. Dim idx As Integer = DropDownList1.SelectedIndex
MultiView1.ActiveViewIndex = idx
B. Dim idx As Integer = DropDownList1.SelectedIndex
MultiView1.Views(idx).Visible = True
C. Dim idx As Integer = Integer.Parse(DropDownList1.SelectedValue)
MultiView1.ActiveViewIndex = idx
D. Dim idx As Integer = Integer.Parse(DropDownList1.SelectedValue)
MultiView1.Views(idx).Visible = True
Answer: A
25. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
To add a Calendar server control to a Web page, you write the following code fragment.
You need to disable the non-week days in the Calendar control.
What should you do?
A. Add the following code segment to the Calendar1 DayRender event handler.
if (e.Day.IsWeekend) {
e.Day.IsSelectable = false;
}
B. Add the following code segment to the Calendar1 DayRender event handler.
if (e.Day.IsWeekend) {
| English | Chinese | Japan | Korean | - 36 - Test Information Co., Ltd. All rights reserved.
if (Calendar1.SelectedDates.Contains(e.Day.Date))
Calendar1.SelectedDates.Remove(e.Day.Date);
}
C. Add the following code segment to the Calendar1 SelectionChanged event handler.
List list = new List();
foreach (DateTime st in (sender as Calendar).SelectedDates) {
if (st.DayOfWeek == DayOfWeek.Saturday ||
st.DayOfWeek == DayOfWeek.Sunday) {
list.Add(st);
}
}
foreach (DateTime dt in list) {
(sender as Calendar).SelectedDates.Remove(dt);
}
D. Add the following code segment to the Calendar1 DataBinding event handler.
List list = new List();
foreach (DateTime st in (sender as Calendar).SelectedDates) {
if (st.DayOfWeek == DayOfWeek.Saturday ||
st.DayOfWeek == DayOfWeek.Sunday) {
list.Add(st);
}
}
foreach (DateTime dt in list) {
(sender as Calendar).SelectedDates.Remove(dt);
}
Answer: A
26. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
To add a Calendar server control to a Web page, you write the following code fragment.
| English | Chinese | Japan | Korean | - 37 - Test Information Co., Ltd. All rights reserved.
You need to disable the non-week days in the Calendar control.
What should you do?
A. Add the following code segment to the Calendar1 DayRender event handler.
If e.Day.IsWeekend Then
e.Day.IsSelectable = False
End If
B. Add the following code segment to the Calendar1 DayRender event handler.
If e.Day.IsWeekend Then
If Calendar1.SelectedDates.Contains(e.Day.Date) Then
Calendar1.SelectedDates.Remove(e.Day.Date)
End If
End If
C. Add the following code segment to the Calendar1 SelectionChanged event handler.
Dim list As New List(Of DateTime)()
For Each st As DateTime In TryCast(sender, Calendar).SelectedDates
If st.DayOfWeek = DayOfWeek.Saturday OrElse _
st.DayOfWeek = DayOfWeek.Sunday Then
list.Add(st)
End If
Next
For Each dt As DateTime In list
TryCast(sender, Calendar).SelectedDates.Remove(dt)
Next
D. Add the following code segment to the Calendar1 DataBinding event handler.
Dim list As New List(Of DateTime)()
For Each st As DateTime In TryCast(sender, Calendar).SelectedDates
| English | Chinese | Japan | Korean | - 38 - Test Information Co., Ltd. All rights reserved.
If st.DayOfWeek = DayOfWeek.Saturday OrElse _
st.DayOfWeek = DayOfWeek.Sunday Then
list.Add(st)
End If
Next
For Each dt As DateTime In list
TryCast(sender, Calendar).SelectedDates.Remove(dt)
Next
Answer: A
27. 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 decimal Price { get; set; }
}
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.
35
You need to display the price of the product from the XML fragment in the lblPrice Label control.
Which code segment should you use?
A. DataTable dt = new DataTable();
dt.ExtendedProperties.Add("Type", "Product");
dt.ReadXml(xmlStream);
lblPrice.Text = dt.Rows[0]["Price"].ToString();
B. XmlReader xr = XmlReader.Create(xmlStream);
Product boughtProduct =
xr.ReadContentAs(typeof(Product), null) as Product;
| English | Chinese | Japan | Korean | - 39 - Test Information Co., Ltd. All rights reserved.
lblPrice.Text = boughtProduct.Price.ToString();
C. XmlSerializer xs = new XmlSerializer(typeof(Product));
Product boughtProduct =
xs.Deserialize(xmlStream) as Product;
lblPrice.Text = boughtProduct.Price.ToString();
D. XmlDocument xDoc = new XmlDocument();
xDoc.Load(xmlStream);
Product boughtProduct = xDoc.OfType().First();
lblPrice.Text = boughtProduct.Price.ToString();
Answer: C
28. 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
End Get
Set(ByVal value As Decimal)
End Set
End Property
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.
35
You need to display the price of the product from the XML fragment in the lblPrice Label control.
Which code segment should you use?
A. Dim dt As New DataTable()
| English | Chinese | Japan | Korean | - 40 - Test Information Co., Ltd. All rights reserved.
dt.ExtendedProperties.Add("Type", "Product")
dt.ReadXml(xmlStream)
lblPrice.Text = dt.Rows(0)("Price").ToString()
B. Dim xr As XmlReader = XmlReader.Create(xmlStream)
Dim boughtProduct As Product = TryCast( _
xr.ReadContentAs(GetType(Product), Nothing), Product)
lblPrice.Text = boughtProduct.Price.ToString()
C. Dim xs As New XmlSerializer(GetType(Product))
Dim boughtProduct As Product = TryCast( _
xs.Deserialize(xmlStream), Product)
lblPrice.Text = boughtProduct.Price.ToString()
D. Dim xDoc As New XmlDocument()
xDoc.Load(xmlStream)
Dim boughtProduct As Product = xDoc.OfType(Of Product)().First()
lblPrice.Text = boughtProduct.Price.ToString()
Answer: C
29. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You add a Web form that contains the following code fragment.
You write the following code segment for the GetData method of the DAL class. (Line numbers are
included for reference only.)
01 public object GetData() {
02 SqlConnection cnn = new SqlConnection( -)
| English | Chinese | Japan | Korean | - 41 - Test Information Co., Ltd. All rights reserved.
03 string strQuery = "SELECT * FROM Products";
04
05 }
You need to ensure that the user can use the sorting functionality of the gvProducts GridView control.
Which code segment should you insert at line 04?
A. SqlCommand cmd = new SqlCommand(strQuery, cnn);
cnn.Open();
return cmd.ExecuteReader();
B. SqlCommand cmd = new SqlCommand(strQuery, cnn);
cnn.Open();
return cmd.ExecuteReader(CommandBehavior.KeyInfo);
C. SqlDataAdapter da = new SqlDataAdapter(strQuery, cnn);
DataSet ds = new DataSet();
da.Fill(ds);
return ds;
D. SqlDataAdapter da = new SqlDataAdapter(strQuery, cnn);
DataSet ds = new DataSet();
da.Fill(ds);
ds.ExtendedProperties.Add("Sortable", true);
return ds.Tables[0].Select();
Answer: C
30. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You add a Web form that contains the following code fragment.
| English | Chinese | Japan | Korean | - 42 - Test Information Co., Ltd. All rights reserved.
You write the following code segment for the GetData method of the DAL class. (Line numbers are
included for reference only.)
01 Public Function GetData() As Object
02 Dim cnn As New SqlConnection( -
03 Dim strQuery As String = "SELECT * FROM Products"
04
05 End Function
You need to ensure that the user can use the sorting functionality of the gvProducts GridView control.
Which code segment should you insert at line 04?
A. Dim cmd As New SqlCommand(strQuery, cnn)
cnn.Open()
Return cmd.ExecuteReader()
B. Dim cmd As New SqlCommand(strQuery, cnn)
cnn.Open()
Return cmd.ExecuteReader(CommandBehavior.KeyInfo)
C. Dim da As New SqlDataAdapter(strQuery, cnn)
Dim ds As New DataSet()
da.Fill(ds)
Return ds
D. Dim da As New SqlDataAdapter(strQuery, cnn)
Dim ds As New DataSet()
da.Fill(ds)
ds.ExtendedProperties.Add("Sortable", True)
Return ds.Tables(0).Select()
Answer: C
31. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You create a class that contains the following code segment. (Line numbers are included for reference
| English | Chinese | Japan | Korean | - 43 - Test Information Co., Ltd. All rights reserved.
only.)
01 public object GetCachedProducts(sqlConnection conn) {
02
03 if (Cache["products"] == null) {
04 SqlCommand cmd = new SqlCommand(
05 "SELECT * FROM Products", conn);
07 conn.Open();
08 Cache.Insert("products", GetData(cmd));
09 conn.Close();
10 }
11 return Cache["products"];
12 }
13
14 public object GetData(SqlCommand prodCmd) {
15
16 }
Each time a Web form has to access a list of products, the GetCachedProducts method is called to
provide this list from the Cache object.
You need to ensure that the list of products is always available in the Cache object.
Which code segment should you insert at line 15?
A. return prodCmd.ExecuteReader();
SqlDataReader dr;
prodCmd.CommandTimeout = int.MaxValue;
B. dr = prodCmd.ExecuteReader();
return dr;
C. SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = prodCmd;
DataSet ds = new DataSet();
return ds.Tables[0];
| English | Chinese | Japan | Korean | - 44 - Test Information Co., Ltd. All rights reserved.
D. SqlDataAdapter da = new SqlDataAdapter(prodCmd);
DataSet ds = new DataSet();
da.Fill(ds);
return ds;
Answer: D
32. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You create a class that contains the following code segment. (Line numbers are included for reference
only.)
01 Public Function GetCachedProducts( _
ByVal conn As SqlConnection) As Object
02
03 If Cache("products") Is Nothing Then
04 Dim cmd As New SqlCommand("SELECT * FROM Products", conn)
05 conn.Open()
06 Cache.Insert("products", GetData(cmd))
07 conn.Close()
08 End If
09 Return Cache("products")
10 End Function
11
12 Public Function GetData(ByVal prodCmd As SqlCommand) As Object
13
14 End Function
Each time a Web form has to access a list of products, the GetCachedProducts method is called to
provide this list from the Cache object.
You need to ensure that the list of products is always available in the Cache object.
Which code segment should you insert at line 13?
A. Return prodCmd.ExecuteReader()
| English | Chinese | Japan | Korean | - 45 - Test Information Co., Ltd. All rights reserved.
Dim dr As SqlDataReader
prodCmd.CommandTimeout = Integer.MaxValue
B. dr = prodCmd.ExecuteReader()
Return dr
C. Dim da As New SqlDataAdapter()
da.SelectCommand = prodCmd
Dim ds As New DataSet()
Return ds.Tables(0)
D. Dim da As New SqlDataAdapter(prodCmd)
Dim ds As New DataSet()
da.Fill(ds)
Return ds
Answer: D
33. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You write the following code segment in the code-behind file to create a Web form. (Line numbers are
included for reference only.)
01 string strQuery = "select * from Products;"
02 + "select * from Categories";
03 SqlCommand cmd = new SqlCommand(strQuery, cnn);
04 cnn.Open();
05 SqlDataReader rdr = cmd.ExecuteReader();
06
07 rdr.Close();
08 cnn.Close();
You need to ensure that the gvProducts and gvCategories GridView controls display the data that is
contained in the following two database tables:
The Products database tabl
The Categories database tabl
| English | Chinese | Japan | Korean | - 46 - Test Information Co., Ltd. All rights reserved.
Which code segment should you insert at line 06?
A. gvProducts.DataSource = rdr;
gvProducts.DataBind();
gvCategories.DataSource = rdr;
gvCategories.DataBind();
B. gvProducts.DataSource = rdr;
gvCategories.DataSource = rdr;
gvProducts.DataBind();
gvCategories.DataBind();
C. gvProducts.DataSource = rdr;
rdr.NextResult();
gvCategories.DataSource = rdr;
gvProducts.DataBind();
gvCategories.DataBind();
D. gvProducts.DataSource = rdr;
gvCategories.DataSource = rdr;
gvProducts.DataBind();
rdr.NextResult();
gvCategories.DataBind();
Answer: D
34. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You write the following code segment in the code-behind file to create a Web form. (Line numbers are
included for reference only.)
01 Dim strQuery As String = "select * from Products;" + _
"select * from Categories"
02 Dim cmd As New SqlCommand(strQuery, cnn)
03 cnn.Open()
04 Dim rdr As SqlDataReader = cmd.ExecuteReader()
| English | Chinese | Japan | Korean | - 47 - Test Information Co., Ltd. All rights reserved.
05
06 rdr.Close()
07 cnn.Close()
You need to ensure that the gvProducts and gvCategories GridView controls display the data that is
contained in the following two database tables:
The Products database tabl
The Categories database tabl
Which code segment should you insert at line 05?
A. gvProducts.DataSource = rdr
gvProducts.DataBind()
gvCategories.DataSource = rdr
gvCategories.DataBind()
B. gvProducts.DataSource = rdr
gvCategories.DataSource = rdr
gvProducts.DataBind()
gvCategories.DataBind()
C. gvProducts.DataSource = rdr
rdr.NextResult()
gvCategories.DataSource = rdr
gvProducts.DataBind()
gvCategories.DataBind()
D. gvProducts.DataSource = rdr
gvCategories.DataSource = rdr
gvProducts.DataBind()
rdr.NextResult()
gvCategories.DataBind()
Answer: D
35. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
| English | Chinese | Japan | Korean | - 48 - Test Information Co., Ltd. All rights reserved.
You create a Web form that contains the following code fragment.
You write the following code segment in the code-behind file. (Line numbers are included for reference
only.)
01 protected void Page_Load(object sender, EventArgs e)
02 {
03 DataSet objDS = new DataSet();
04 SqlDataAdapter objDA = new SqlDataAdapter(objCmd);
05 objDA.Fill(objDS);
06 gridCities.DataSource = objDs;
07 gridCities.DataBind();
08 Session["ds"] = objDS;
09 }
10 protected void btnSearch_Click(object sender, EventArgs e)
11 {
12
13 }
You need to ensure that when the btnSearch Button control is clicked, the records in the gridCities
GridView control are filtered by using the value of the txtSearch TextBox.
Which code segment you should insert at line 12?
A. DataSet ds = gridCities.DataSource as DataSet;
DataView dv = ds.Tables[0].DefaultView;
dv.RowFilter = "CityName LIKE '" + txtSearch.Text + "%'";
gridCities.DataSource = dv;
gridCities.DataBind();
B. DataSet ds = Session["ds"] as DataSet;
| English | Chinese | Japan | Korean | - 49 - Test Information Co., Ltd. All rights reserved.
DataView dv = ds.Tables[0].DefaultView;
dv.RowFilter = "CityName LIKE '" + txtSearch.Text + "%'";
gridCities.DataSource = dv;
gridCities.DataBind();
C. DataTable dt = Session["ds"] as DataTable;
DataView dv = dt.DefaultView;
dv.RowFilter = "CityName LIKE '" + txtSearch.Text + "%'";
gridCities.DataSource = dv;
gridCities.DataBind();
D. DataSet ds = Session["ds"] as DataSet;
DataTable dt = ds.Tables[0];
DataRow[] rows = dt.Select("CityName LIKE '" + txtSearch.Text + "%'");
gridCities.DataSource = rows;
gridCities.DataBind();
Answer: B
36. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You create a Web form that contains the following code fragment.
You write the following code segment in the code-behind file. (Line numbers are included for reference
only.)
01 Protected Sub Page_Load(ByVal sender As Object, _
02 ?ByVal e As EventArgs)
03 Dim objDS As New DataSet()
04 Dim objDA As New SqlDataAdapter(objCmd)
05 objDA.Fill(objDS)
| English | Chinese | Japan | Korean | - 50 - Test Information Co., Ltd. All rights reserved.
06 gridCities.DataSource = objDS
07 gridCities.DataBind()
08 Session("ds") = objDS
09 End Sub
10 Protected Sub btnSearch_Click(ByVal sender As Object, _
11 ByVal e As EventArgs)
12
13 End Sub
You need to ensure that when the btnSearch Button control is clicked, the records in the gridCities
GridView control are filtered by using the value of the txtSearch TextBox.
Which code segment you should insert at line 12?
Dim ds As DataSet = TryCast(gridCities.DataSource, DataSet)
Dim dv As DataView = ds.Tables(0).DefaultView
dv.RowFilter = "CityName LIKE '" + txtSearch.Text + "%'"
gridCities.DataSource = dv
gridCities.DataBind()
Dim ds As DataSet = TryCast(Session("ds"), DataSet)
Dim dv As DataView = ds.Tables(0).DefaultView
dv.RowFilter = "CityName LIKE '" + txtSearch.Text + "%'"
gridCities.DataSource = dv
gridCities.DataBind()
Dim dt As DataTable = TryCast(Session("ds"), DataTable)
Dim dv As DataView = dt.DefaultView
dv.RowFilter = "CityName LIKE '" + txtSearch.Text + "%'"
gridCities.DataSource = dv
gridCities.DataBind()
Dim ds As DataSet = TryCast(Session("ds"), DataSet)
Dim dt As DataTable = ds.Tables(0)
Dim rows As DataRow() = _
| English | Chinese | Japan | Korean | - 51 - Test Information Co., Ltd. All rights reserved.
?dt.[Select]("CityName LIKE '" + txtSearch.Text + "%'")
gridCities.DataSource = rows
gridCities.DataBind()
Answer: B
37. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. The
application consumes a Microsoft Windows Communication Foundation (WCF) service.
The WCF service exposes the following method.
[WebInvoke]
string UpdateCustomerDetails(string custID);
The application hosts the WCF service by using the following code segment.
WebServiceHost host = new WebServiceHost(typeof(CService),
new Uri("http://win/"));
ServiceEndpoint ep = host.AddServiceEndpoint(typeof(ICService),
new WebHttpBinding(), "");
You need to invoke the UpdateCustomerDetails method.
Which code segment should you use?
A. WebChannelFactory wcf = new
WebChannelFactory(new Uri("http: //win"))
ICService channel = wcf.CreateChannel();
string s = channel.UpdateCustomerDetails("CustID12");
B. WebChannelFactory wcf = new
WebChannelFactory(new Uri("http:
//win/UpdateCustomerDetails"))
ICService channel = wcf.CreateChannel();
string s = channel.UpdateCustomerDetails("CustID12");
C. ChannelFactory cf = new
ChannelFactory(new
WebHttpBinding(), "http: //win/UpdateCustomerDetails")
http://win/"| English | Chinese | Japan | Korean | - 52 - Test Information Co., Ltd. All rights reserved.
ICService channel = cf.CreateChannel();
string s = channel.UpdateCustomerDetails("CustID12");
D. ChannelFactory cf = new
ChannelFactory(new
BasicHttpBinding(), "http: //win ")
cf.Endpoint.Behaviors.Add(new WebHttpBehavior());
ICService channel = cf.CreateChannel();
string s = channel.UpdateCustomerDetails("CustID12");
Answer: A
38. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. The
application consumes a Microsoft Windows Communication Foundation (WCF) service.
The WCF service exposes the following method.
_
Function UpdateCustomerDetails(ByVal custID As String) As String
The application hosts the WCF service by using the following code segment.
Dim host As New WebServiceHost(GetType(CService), _
New Uri("http://win/"))
Dim ep As ServiceEndpoint = host.AddServiceEndpoint( _
GetType(ICService), New WebHttpBinding(), "")
You need to invoke the UpdateCustomerDetails method.
Which code segment should you use?
A. dim wcf As New WebChannelFactory(Of ICService)( _
New Uri("http: //win"))
Dim channel As ICService = wcf.CreateChannel()
Dim s As String = channel.UpdateCustomerDetails("CustID12")
B. dim wcf As New WebChannelFactory(Of ICService)( _
New Uri("http: //win/UpdateCustomerDetails"))
Dim channel As ICService = wcf.CreateChannel()
http://win/"| English | Chinese | Japan | Korean | - 53 - Test Information Co., Ltd. All rights reserved.
Dim s As String = channel.UpdateCustomerDetails("CustID12")
C. Dim cf As New ChannelFactory(Of ICService)( _
New WebHttpBinding(), "http: //win/UpdateCustomerDetails")
Dim channel As ICService = cf.CreateChannel()
Dim s As String = channel.UpdateCustomerDetails("CustID12")
D. Dim cf As New ChannelFactory(Of ICService)( _
New BasicHttpBinding(), "http: //win ")
cf.Endpoint.Behaviors.Add(New WebHttpBehavior())
Dim channel As ICService = cf.CreateChannel()
Dim s As String = channel.UpdateCustomerDetails("CustID12")
Answer: A
39. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You create a Microsoft Windows Communication Foundation (WCF) service that exposes the following
service contract. (Line numbers are included for reference only.)
01 [ServiceContract]
02 public interface IBlogService
03 {
04 [OperationContract]
05 [WebGet(ResponseFormat=WebMessageFormat.Xml)]
06 Rss20FeedFormatter GetBlog();
07 }
You configure the WCF service to use the WebHttpBinding class, and to be exposed at the following URL:
http://www.contoso.com/BlogService
You need to store the result of the GetBlog operation in an XmlDocument variable named xmlBlog in a
Web form.
Which code segment should you use?
A. string url = @"http: //www.contoso.com/BlogService/GetBlog";
XmlReader blogReader = XmlReader.Create(url);
http://www.contoso.com/BlogService| English | Chinese | Japan | Korean | - 54 - Test Information Co., Ltd. All rights reserved.
xmlBlog.Load(blogReader);
B. string url = @"http: //www.contoso.com/BlogService";
XmlReader blogReader = XmlReader.Create(url);
xmlBlog.Load(blogReader);
C. Uri blogUri = new Uri(@"http: //www.contoso.com/BlogService");
ChannelFactory blogFactory = new
ChannelFactory(blogUri);
IBlogService blogSrv = blogFactory.CreateChannel();
Rss20FeedFormatter feed = blogSrv.GetBlog();
xmlBlog.LoadXml(feed.ToString());
D. Uri blogUri = new Uri(@"http: //www.contoso.com/BlogService/GetBlog");
ChannelFactory blogFactory = new
ChannelFactory(blogUri);
IBlogService blogSrv = blogFactory.CreateChannel();
Rss20FeedFormatter feed = blogSrv.GetBlog();
xmlBlog.LoadXml(feed.Feed.ToString());
Answer: A
40. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You create a Microsoft Windows Communication Foundation (WCF) service that exposes the following
service contract. (Line numbers are included for reference only.)
01 _
02 Public Interface IBlogService
03 _
04 _
05 Function GetBlog() As Rss20FeedFormatter
06 End Interface
You configure the WCF service to use the WebHttpBinding class and to be exposed at the following URL:
http://www.contoso.com/BlogService
http://www.contoso.com/BlogService| English | Chinese | Japan | Korean | - 55 - Test Information Co., Ltd. All rights reserved.
You need to store the result of the GetBlog operation in an XmlDocument variable named xmlBlog in a
Web form.
Which code segment should you use?
A. Dim url As String = "http: //www.contoso.com/BlogService/GetBlog"
Dim blogReader As XmlReader = XmlReader.Create(url)
xmlBlog.Load(blogReader)
B. Dim url As String = "http: //www.contoso.com/BlogService"
Dim blogReader As XmlReader = XmlReader.Create(url)
xmlBlog.Load(blogReader)
C. Dim binding As New BasicHttpBinding()
Dim blogUri As New _
EndpointAddress("http: //www.contoso.com/BlogService")
Dim blogFactory As New _
ChannelFactory(Of IBlogService)(binding, blogUri)
Dim blogSrv As IBlogService = blogFactory.CreateChannel()
Dim feed As Rss20FeedFormatter = blogSrv.GetBlog()
xmlBlog.LoadXml(feed.ToString())
D. Dim binding As New BasicHttpBinding()
Dim blogUri As New _
EndpointAddress("http: //www.contoso.com/BlogService/GetBlog")
Dim blogFactory As New _
ChannelFactory(Of IBlogService)(binding, blogUri)
Dim blogSrv As IBlogService = blogFactory.CreateChannel()
Dim feed As Rss20FeedFormatter = blogSrv.GetBlog()
xmlBlog.LoadXml(feed.Feed.ToString())
Answer: A
41. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You plan to add a custom parameter in the SqlDataSource control.
| English | Chinese | Japan | Korean | - 56 - Test Information Co., Ltd. All rights reserved.
You write the following code fragment.
You write the following code segment to create a custom parameter class.
public class DayParameter : Parameter {
}
You need to ensure that the custom parameter returns the current date and time.
Which code segment should you add to the DayParameter class?
A. protected DayParameter()
: base("Value", TypeCode.DateTime, DateTime.Now.ToString())
{
}
B. protected override void LoadViewState(object savedState)
{
((StateBag)savedState).Add("Value", DateTime.Now);
}
C. protected override object Evaluate(HttpContext context, Control control) {
return DateTime.Now;
}
D. protected override Parameter Clone()
{
Parameter pm = new DayParameter();
| English | Chinese | Japan | Korean | - 57 - Test Information Co., Ltd. All rights reserved.
pm.DefaultValue = DateTime.Now;
return pm;
}
Answer: C
42. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You plan to add a custom parameter in the SqlDataSource control.
You write the following code fragment.
You write the following code segment to create a custom parameter class.
Public Class DayParameter
Inherits Parameter
End Class
You need to ensure that the custom parameter returns the current date and time.
Which code segment should you add to the DayParameter class?
A. Protected Sub New()
MyBase.New("Value", TypeCode.DateTime, DateTime.Now.ToString())
End Sub
B. Protected Overloads Overrides Sub _
LoadViewState(ByVal savedState As Object)
DirectCast(savedState, _
| English | Chinese | Japan | Korean | - 58 - Test Information Co., Ltd. All rights reserved.
StateBag).Add("Value", DateTime.Now)
End Sub
C. Protected Overloads Overrides Function _
Evaluate(ByVal context As HttpContext, _
ByVal control As Control) As Object
Return DateTime.Now
End Function
D. Protected Overloads Overrides Function _
Clone() As Parameter
Dim pm As Parameter = New DayParameter()
pm.DefaultValue = DateTime.Now
Return pm
End Function
Answer: C
43. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. The
application has an ASPX page named ErrorPage.aspx.
You plan to manage the unhandled application exceptions.
You need to perform the following tasks:
Display the ErrorPage.aspx page
Write the exceptioninformation in the Event log file.
Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)
A. Add the following code fragment to the Web.config file.
B. Add the following code fragment to the Web.config file.
C. Add the following code segment to the Global.asax file.
void Application_Error(object sender, EventArgs e)
{
| English | Chinese | Japan | Korean | - 59 - Test Information Co., Ltd. All rights reserved.
Exception exc = Server.GetLastError();
//Write Exception details to event log
}
D. Add the following code segment to the ErrorPage.aspx file.
void Page_Error(object sender, EventArgs e)
{
Exception exc = Server.GetLastError();
//Write Exception details to event log
Server.ClearError();
}
Answer: AC
44. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. The
application has an ASPX page named ErrorPage.aspx.
You plan to manage the unhandled application exceptions.
You need to perform the following tasks:
Display the ErrorPage.aspx page
Write the exception information in the Event log file
Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)
A. Add the following code fragment to the Web.config file.
B. Add the following code fragment to the Web.config file.
C. Add the following code segment to the Global.asax file.
Public Sub Application_Error(ByVal sender As Object, _
ByVal e As EventArgs)
Dim exc As Exception = Server.GetLastError()
'Write Exception details to event log
End Sub
| English | Chinese | Japan | Korean | - 60 - Test Information Co., Ltd. All rights reserved.
D. Add the following code segment to the ErrorPage.aspx file.
Public Sub Page_Error(ByVal sender As Object, _
ByVal e As EventArgs)
Dim exc As Exception = Server.GetLastError()
'Write Exception details to event log
Server.ClearError()
End Sub
Answer: AC
45. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. The
application contains two Web pages named OrderDetails.aspx and OrderError.htm.
If the application throws unhandled errors in the OrderDetails.aspx Web page, a stack trace is displayed
to remote users.
You need to ensure that the OrderError.htm Web page is displayed for unhandled errors only in the
OrderDetails.aspx Web page.
What should you do?
A. Set the Page attribute for the OrderDetails.aspx Web page in the following manner.
Add the following section to the Web.config file.
B. Set the Page attribute for the OrderDetails.aspx Web page in the following manner.
Add the following section to the Web.config file.
C. Set the Page attribute for the OrderDetails.aspx Web page in the following manner.
| English | Chinese | Japan | Korean | - 61 - Test Information Co., Ltd. All rights reserved.
CodeFile="OrderDetails.aspx.cs" Inherits="OrderDetails"
ErrorPage="~/OrderError.htm" Debug="false" %>
Add the following section to the Web.config file.
D. Set the Page attribute for the OrderDetails.aspx Web page in the following manner.
Add the following section to the Web.config file.
Answer: C
46. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. The
application contains two Web pages named OrderDetails.aspx and OrderError.htm.
If the application throws unhandled errors in the OrderDetails.aspx Web page, a stack trace is displayed
to remote users.
You need to ensure that the OrderError.htm Web page is displayed for unhandled errors only in the
OrderDetails.aspx Web page.
What should you do?
A. Set the Page attribute for the OrderDetails.aspx Web page in the following manner.
Add the following section to the Web.config file.
B. Set the Page attribute for the OrderDetails.aspx Web page in the following manner.
| English | Chinese | Japan | Korean | - 62 - Test Information Co., Ltd. All rights reserved.
CodeFile="OrderDetails.aspx.vb" Inherits="OrderDetails" Debug="true" %>
Add the following section to the Web.config file.
C. Set the Page attribute for the OrderDetails.aspx Web page in the following manner.
Add the following section to the Web.config file.
D. Set the Page attribute for the OrderDetails.aspx Web page in the following manner.
Add the following section to the Web.config file.
Answer: C
47. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You write the following code fragment.
| English | Chinese | Japan | Korean | - 63 - Test Information Co., Ltd. All rights reserved.
You need to ensure that when you click the btnSubmit Button control, each Label control value is
asynchronously updatable.
Which code segment should you use?
A. protected void btnSubmit_Click(object sender, EventArgs e)
{
Label1.Text = "Label1 updated value";
Label2.Text = "Label2 updated value";
Label3.Text = "Label3 updated value";
}
B. protected void btnSubmit_Click(object sender, EventArgs e)
{
Label1.Text = "Label1 updated value";
Label2.Text = "Label2 updated value";
ScriptManager1.RegisterDataItem(Label3, "Label3 updated value");
}
C. protected void btnSubmit_Click(object sender, EventArgs e)
{
ScriptManager1.RegisterDataItem(Label1, "Label1 updated value");
ScriptManager1.RegisterDataItem(Label2, "Label2 updated value");
Label3.Text = "Label3 updated value";
}
D. protected void btnSubmit_Click(object sender, EventArgs e)
{
Label1.Text = "Label1 updated value";
Label2.Text = "Label2 updated value";
ScriptManager1.RegisterAsyncPostBackControl(Label3);
| English | Chinese | Japan | Korean | - 64 - Test Information Co., Ltd. All rights reserved.
Label3.Text = "Label3 updated value";
}
Answer: B
48. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You write the following code fragment.
You need to ensure that when you click the btnSubmit Button control, each Label control value is
asynchronously updatable.
Which code segment should you use?
A. Protected Sub btnSubmit_Click(ByVal sender As Object, _
ByVal e As EventArgs)
Label1.Text = "Label1 updated value"
Label2.Text = "Label2 updated value"
Label3.Text = "Label3 updated value"
End Sub
B. Protected Sub btnSubmit_Click(ByVal sender As Object, _
ByVal e As EventArgs)
Label1.Text = "Label1 updated value"
| English | Chinese | Japan | Korean | - 65 - Test Information Co., Ltd. All rights reserved.
Label2.Text = "Label2 updated value"
ScriptManager1.RegisterDataItem(Label3, _
"Label3 updated value")
End Sub
C. Protected Sub btnSubmit_Click(ByVal sender As Object, _
ByVal e As EventArgs)
ScriptManager1.RegisterDataItem(Label1, _
"Label1 updated value")
ScriptManager1.RegisterDataItem(Label2, _
"Label2 updated value")
Label3.Text = "Label3 updated value"
End Sub
D. Protected Sub btnSubmit_Click(ByVal sender As Object, _
ByVal e As EventArgs)
Label1.Text = "Label1 updated value"
Label2.Text = "Label2 updated value"
ScriptManager1.RegisterAsyncPostBackControl(Label3)
Label3.Text = "Label3 updated value"
End Sub
Answer: B
49. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You create a Web form in the application by using the following code fragment. (Line numbers are
included for reference only.)
01
02 protected void Button_Handler(object sender, EventArgs e)
03 {
04 // some long-processing operation.
05 }
| English | Chinese | Japan | Korean | - 66 - Test Information Co., Ltd. All rights reserved.
06
07
08
10
11
13
14
15
17
18
19
You plan to create a client-side script code by using ASP.NET AJAX.
You need to ensure that while a request is being processed, any subsequent Click events on the
btnSubmit Button control are suppressed.
Which code fragment should you insert at line 10?
A.
var rm = Sys.WebForms.PageRequestManager.getInstance();
rm.add_beginRequest(checkPostback);
function checkPostback(sender, args) {
if (rm.get_isInAsyncPostBack() &&
args.get_postBackElement().id == 'btnSubmit') {
rm.abortPostBack();
alert('A previous request is still in progress.');
}
}
| English | Chinese | Japan | Korean | - 67 - Test Information Co., Ltd. All rights reserved.
B.
var rm = Sys.WebForms.PageRequestManager.getInstance();
rm.add_initializeRequest(checkPostback);
function checkPostback(sender, args) {
if (rm.get_isInAsyncPostBack() &&
args.get_postBackElement().id == 'btnSubmit') {
rm.abortPostBack();
alert('A previous request is still in progress.');
}
}
C.
var rm = Sys.WebForms.PageRequestManager.getInstance();
rm.add_initializeRequest(checkPostback);
function checkPostback(sender, args) {
if (rm.get_isInAsyncPostBack() &&
args.get_postBackElement().id == 'btnSubmit') {
args.set_cancel(true);
alert('A previous request is still in progress.');
}
}
D.
var rm = Sys.WebForms.PageRequestManager.getInstance();
rm.add_beginRequest(checkPostback);
function checkPostback(sender, args) {
var request = args.get_request();
if (rm.get_isInAsyncPostBack() &&
args.get_postBackElement().id == 'btnSubmit') {
| English | Chinese | Japan | Korean | - 68 - Test Information Co., Ltd. All rights reserved.
request.completed(new Sys.CancelEventArgs());
alert('A previous request is still in progress.');
}
}
Answer: C
50. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You create a Web form in the application by using the following code fragment. (Line numbers are
included for reference only.)
01
02 Protected Sub Button_Handler(ByVal sender As Object, _
03 ByVal e As EventArgs)
04 ' some long-processing operation.
05 End Sub
06
07
08
10
11
13
14
15
17
18
19
| English | Chinese | Japan | Korean | - 69 - Test Information Co., Ltd. All rights reserved.
You plan to create a client-side script code by using ASP.NET AJAX.
You need to ensure that while a request is being processed, any subsequent Click events on the
btnSubmit Button control are suppressed.
Which code fragment should you insert at line 10?
A.
var rm = Sys.WebForms.PageRequestManager.getInstance();
rm.add_beginRequest(checkPostback);
function checkPostback(sender, args) {
if (rm.get_isInAsyncPostBack() &&
args.get_postBackElement().id == 'btnSubmit') {
rm.abortPostBack();
alert('A previous request is still in progress.');
}
}
B.
var rm = Sys.WebForms.PageRequestManager.getInstance();
rm.add_initializeRequest(checkPostback);
function checkPostback(sender, args) {
if (rm.get_isInAsyncPostBack() &&
args.get_postBackElement().id == 'btnSubmit') {
rm.abortPostBack();
alert('A previous request is still in progress.');
}
}
C.
var rm = Sys.WebForms.PageRequestManager.getInstance();
rm.add_initializeRequest(checkPostback);
| English | Chinese | Japan | Korean | - 70 - Test Information Co., Ltd. All rights reserved.
function checkPostback(sender, args) {
if (rm.get_isInAsyncPostBack() &&
args.get_postBackElement().id == 'btnSubmit') {
args.set_cancel(true);
alert('A previous request is still in progress.');
}
}
D.
var rm = Sys.WebForms.PageRequestManager.getInstance();
rm.add_beginRequest(checkPostback);
function checkPostback(sender, args) {
var request = args.get_request();
if (rm.get_isInAsyncPostBack() &&
args.get_postBackElement().id == 'btnSubmit') {
request.completed(new Sys.CancelEventArgs());
alert('A previous request is still in progress.');
}
}
Answer: C
51. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You write the following code segment to create a JavaScript file named CalculatorScript.js.
function divide(a, b) {
if (b == 0) {
var errorMsg = Messages.DivideByZero;
alert(errorMsg);
return null;
| English | Chinese | Japan | Korean | - 71 - Test Information Co., Ltd. All rights reserved.
}
return a/b;
}
You embed the CalculatorScript.js file as a resource in a Class Library project. The namespace for this
project is Calculator.Resources. The JavaScript function retrieves messages from a resource file named
MessageResources.resx by using the JavaScript Messages object.
You add an AJAX Web form in the ASP.NET application. You reference the Class Library in the application.
You add an ASP.NET AJAX ScriptReference element to the AJAX Web form.
You need to ensure that the JavaScript function can access the error messages that are defined in the
resource file.
Which code segment should you add in the AssemblyInfo.cs file?
A. [assembly: ScriptResource
("CalculatorScript", "MessageResources", "Messages")]
B. [assembly: ScriptResource
("CalculatorScript.js", "MessageResources.resx", "Messages")]
C. [assembly: ScriptResource
("Calculator.Resources.CalculatorScript.js", "Calculator.Resources.MessageResources", "Messages")]
D. [assembly: ScriptResource
("Calculator.Resources.CalculatorScript", "Calculator.Resources.MessageResources.resx",
"Messages")]
Answer: C
52. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You write the following code segment to create a JavaScript file named CalculatorScript.js.
function divide(a, b) {
if (b == 0) {
var errorMsg = Messages.DivideByZero;
alert(errorMsg);
return null;
| English | Chinese | Japan | Korean | - 72 - Test Information Co., Ltd. All rights reserved.
}
return a/b;
}
You embed the CalculatorScript.js file as a resource in a Class Library project. The namespace for this
project is Calculator.Resources. The JavaScript function retrieves messages from a resource file named
MessageResources.resx by using the JavaScript Messages object.
You add an AJAX Web form in the ASP.NET application. You reference the Class Library in the application.
You add an ASP.NET AJAX ScriptReference element to the AJAX Web form.
You need to ensure that the JavaScript function can access the error messages that are defined in the
resource file.
Which code segment should you add in the AssemblyInfo.vb file?
A.
B.
C.
D.
Answer: C
53. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You create an AJAX-enabled Web form by using the following code fragment.
| English | Chinese | Japan | Korean | - 73 - Test Information Co., Ltd. All rights reserved.
...
When the updFirstPanel UpdatePanel control is updated, a dynamic client script is registered.
You write the following code segment in the code-behind file of the Web form. (Line numbers are included
for reference only.)
01 protected void Page_Load(object sender, EventArgs e)
02 {
03 if(IsPostBack)
04 {
05 string generatedScript = ScriptGenerator.GenerateScript();
06
07 }
08 }
You need to ensure that the client-script code is registered only when an asynchronous postback is issued
on the updFirstPanel UpdatePanel control.
Which code segment should you insert at line 06?
A. ClientScript.RegisterClientScriptBlock(typeof(TextBox),
"txtInfo_Script", generatedScript);
B. ScriptManager.RegisterClientScriptBlock(this, typeof(Page),
"txtInfo_Script", generatedScript, false);
C. ClientScript.RegisterClientScriptBlock(typeof(Page),
| English | Chinese | Japan | Korean | - 74 - Test Information Co., Ltd. All rights reserved.
"txtInfo_Script", generatedScript);
D. ScriptManager.RegisterClientScriptBlock(txtInfo,
typeof(TextBox), "txtInfo_Script", generatedScript, false);
Answer: D
54. You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You create an AJAX-enabled Web form by using the following code fragment.
...
When the updFirstPanel UpdatePanel control is updated, a dynamic client script is registered.
You write the following code segment in the code-behind file of the Web form. (Line numbers are included
for reference only.)
01 Protected Sub Page_Load(ByVal sender As Object, _
ByVal e As EventArgs)
02 If Not IsPostBack Then
03 Dim generatedScript As String = _
| English | Chinese | Japan | Korean | - 75 - Test Information Co., Ltd. All rights reserved.
ScriptGenerator.GenerateScript()
04
05 End If
06 End Sub
You need to ensure that the client-script code is registered only when an asynchronous postback is issued
on the updFirstPanel UpdatePanel control.
Which code segment should you insert at line 04?
A. ClientScript.RegisterClientScrip