You are implementing an ASP.NET page. You add and configure the following ObjectDataSource.
<asp:ObjectDataSource SelectMethod=”GetProductByProductId”
ID=”odc” runat=”server” TypeName=”ProductDAL”>
<SelectParameters>
<asp:Parameter Name=”productId” Type=”Int32″ />
</SelectParameters>
</asp:ObjectDataSource>
The page will be called with a query string field named pid. You need to configure the
ObjectDataSource control to pass the value of the pid field to GetProductsByProductId method.
What should you do?
A.
Replace the asp:Parameter with the following declaration.
<asp:QueryStringParameter DefaultValue=”pid” Name=”productId”
Type=”Int32″ />
B.
Replace the asp:Parameter with the following declaration.
<asp:QueryStringParameter QueryStringField=”pid” Name=”productId” Type=”Int32″ /
>
C.
Add the following event handler to the Selecting event of the ObjectDataSource control.
Private Sub odc_Selecting(ByVal sender As Object,
ByVal e As _
System.Web.UI.WebControls.ObjectDataSourceSelectingEventArgs) _
Handles odc.Selecting
D.
InputParameters(“pid”) = Request.QueryString(“productId”)
End Sub
E.
Add the following code segment to the pages code-behind.
Protected Sub Page_Load(ByVal sender As Object,
ByVal e As System.EventArgs) Handles Me.Load
odc.SelectParameters.Add(“productId”, Request.QueryString(“pid”))
End Sub