Question:You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.

You create the SqlDataSource1 DataSource control to retrieve the details of authors.
You write the following code fragment.

01 <asp:SqlDataSource ID="SqlDataSource1" runat="server"
02 ConnectionString="<%$ ConnectionStrings:Pubs %>"
03 SelectCommand="SELECT [au_id], [au_lname], [state] FROM
04 [authors]"
06 >
08 </asp:SqlDataSource>

You create the DropDownList1 DropDownList control that contains a list of the author last names.
You write the following code fragment.

<asp:dropdownlist id="DropDownList1" runat="server">
<asp:listitem> Madrid </asp:listitem>
<asp:listitem> Oslo </asp:listitem>
<asp:listitem> Lisbon </asp:listitem>
</asp:dropdownlist>

You need to ensure that the SqlDataSource1 DataSource control retrieves the corresponding records for the author last name that is selected from the DropDownList1 DropDownList control.
What should you do?

 

A Add the following code segment to line 05.
FilterExpression="au_lname = ? "
Add the following code fragment to line 07.
<FilterParameters>
<asp:ControlParameter Name="au_lname" ControlID="DropDownList1" PropertyName="SelectedValue" />
</FilterParameters> 

B Add the following code segment to line 05.
FilterExpression="au_lname = ? "
Add the following code fragment to line 07.
<SelectParameters>
<asp:Parameter Name="DropDownList1" Type="String" />
</SelectParameters> 

C Add the following code segment to line 05.
FilterExpression="au_lname = '{0}'"
Add the following code fragment to line 07.
<SelectParameters>
<asp:Parameter Name="DropDownList1" Type="String" />
</SelectParameters> 

D Add the following code segment to line 05.
FilterExpression="au_lname = '{0}'"
Add the following code fragment to line 07.
<FilterParameters>
<asp:ControlParameter Name="au_lname" ControlID="DropDownList1" PropertyName="SelectedValue" />
</FilterParameters> 

+ Answer
+ Report
Total Preview: 1765

Copyright © 2024. Powered by Intellect Software Ltd