You need to configure the ObjectDataSource control to pass the value of the pid field to GetProductsByProductId method

You are implementing an ASP.NET page. You add and configure the following 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?

You are implementing an ASP.NET page. You add and configure the following 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.
protected void odc_Selecting(object sender,
ObjectDataSourceSelectingEventArgs e)
{

D.
InputParameters[“p id “] = Request.QueryString[“p roductId “];
}

E.
Add the following code segment to the pages code-behind.
protected void Page_Load(object sender, EventArgs e)
{
odc.SelectParameters.Add(“productId”, Request.QueryString[“p i d”]);
}



Leave a Reply 0

Your email address will not be published. Required fields are marked *