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 Microsoft Windows Communication Foundation (WCF) service that exposes the following service contract. (Line numbers are included for reference only.)
<ServiceContract> _
Public Interface IBlogService
<OperationContract> _
<WebGet(ResponseFormat := WebMessageFormat.Xml)> _
Function GetBlog() As Rss20FeedFormatter
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
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?
Which code segment should you use?
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.
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?
Which code segment you should insert at line 11?
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.
<asp:TextBox runat="server" ID="txtSearch" />
<asp:Button runat="server" ID="btnSearch" Text="Search" OnClick="btnSearch_Click" />
<asp:GridView runat="server" ID="gridCities" />
You write the following code segment in the code-behind file. (Line numbers are included for reference only.)
01 Protected Sub Page_Load(sender As Object, e As EventArgs)
02 Dim objDS__1 As New DataSet()
03 Dim objDA As New SqlDataAdapter(objCmd)
04 objDA.Fill(objDS__1)
05 gridCities.DataSource = objDs
06 gridCities.DataBind()
07 Session("ds") = objDS__1
08 End Sub
09 Protected Sub btnSearch_Click(sender As Object, e As EventArgs)
10
11 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 11?
Which code segment should you insert at line 05?
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()
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?
Which code segment should you insert at line 14?
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(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(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 14?
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 add a Web form that contains the following code fragment.
<asp:GridView ID="gvProducts" runat="server" AllowSorting="True" DataSourceID="Products"> </asp:GridView>
<asp:ObjectDataSource ID="Products" runat="server" SelectMethod="GetData" TypeName="DAL" /> </asp:ObjectDataSource>
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?
Which code segment should you use?
You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You write the following code fragment.
<asp:DropDownList AutoPostBack="true" ID="DropDownList1" runat="server" onselectedindexchanged= "DropDownList1_SelectedIndexChanged">
<asp:ListItem>1</asp:ListItem>
<asp:ListItem>2</asp:ListItem>
<asp:ListItem>3</asp:ListItem>
</asp:DropDownList>
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?
Which code segment should you use?
You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You write the following code fragment.
<asp:ListBox SelectionMode="Multiple" ID="ListBox1" runat="server"> </asp:ListBox>
<asp:ListBox ID="ListBox2" runat="server"> </asp:ListBox>
<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
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?
Which code fragment should you use?
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.
<?xml version="1.0" encoding="utf-8" ?>
<clients>
<client ID="1" Name="John Evans" />
<client ID="2" Name="Mike Miller"/> …
</clients>
You also write the following code segment in the code-behind file of the Web page.
Protected Sub BulletedList1_Click(sender As Object, 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?
Which code fragment should you add to the Web page?
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 ServerValidate(source As Object, args As ServerValidateEventArgs)
Dim dt As DateTime = [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?