What should you do next?

You are developing a product page named Catalog.aspx for Web application that will be integrated into Domain.com’s existing e-Commerce Web site. The Catalog.aspx page must access data from the CKProducts database. You need to use a stored procedure named sp_GetAllProducts to display data in a GridView control named _gridView. The stored procedure takes no parameters. You add a SqlDataSource control to the page.
What should you do next? (Each correct answer presents part of the solution.
Choose two.)

You are developing a product page named Catalog.aspx for Web application that will be integrated into Domain.com’s existing e-Commerce Web site. The Catalog.aspx page must access data from the CKProducts database. You need to use a stored procedure named sp_GetAllProducts to display data in a GridView control named _gridView. The stored procedure takes no parameters. You add a SqlDataSource control to the page.
What should you do next? (Each correct answer presents part of the solution.
Choose two.)

A.
Set the DataSourceID property of the GridView control to the ID of the SqlDataSource.

B.
Set the SelectMethod property to the stored procedure name "sp_GetAllProducts".

C.
Set the SelectCommand property to the stored procedure name "sp_GetAllProducts".

D.
Set the DataSourceID property of the GridView control to the stored procedure name "sp_GetAllProducts".

Explanation:
You need to bind data to a Grid View control, which is a tabular data-bound control. You have already created the SqlDataSource control which allows you to bind data from the Oracle database. You now need to specify the SqlDataSource as the DataSourceID for the GridView control, and specify the sp_GetAllProducts stored procedure as the SelectCommand of the SqlDataSource control. The SqlDataSource control will then use the stored procedure to retrieve the required data.

Incorrect Answers:
B: You are using a stored procedure to retrieve the data from the database. You should therefore use the SelectCommand property to specify the stored procedure to be used, and not a SelectMethod. The SelectMethod property is used when you use a method in a business class to return the data.
D: The DataSourceID property specifies the SqlDataSource control that populates the data in the GridView control. You must therefore specify the ID of the SqlDataSource as the DataSourceID and not he stored procedure name.



Leave a Reply 0

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