Duration: 17 minutes
Summary: In this video, we talk about two items: (1) how to handle errors in the data source, (2) how to use a stored procedure to populate a GridView. We start with the error handling. In the select command of the data source for the grid, we intentionally neglected to add the schema in front of the table name. When we viewed the page that gave us a long error page with lots of information indicating that it cannot find the Address table. We then looked at the events available for the data source. These events are divided into “Selecting” (when we are about to select the data) and “Selected” (when the data is already selected). We handled the second event. We captured the error in a label and we specified that the error has been handled. In the second part of the video, we showed how to populate the grid from a proc. We also used a query string parameter to feed the employee ID to the proc.
Methodology of the development of example: Good coding standard and simplified design to illustrate the key points.
Technology Used: ASP.NET and Visual Studio 2010
Keyword: ASP.NET 4, Visual Studio 2010, Selecting, Selected, Exception, SelectCommand, ExceptionHandledSqlDataSourceStatusEventArgs, GridView, SelectCommandType, SelectParameters, QueryStringParameter, DefaultValue, QueryStringField.