SlideShare a Scribd company logo
Slide 1 of 7Ver. 1.0
Developing Web Applications Using ASP.NET
In this session, you will learn to:
Create and retrieve database connections by using the
Web.Config file
Access relational data by using the SqlDataSource control and
data controls
Access XML data by using the XmlDataSource control and
data controls
Access objects as data by using the ObjectDataSource control
and data controls
Objectives
Slide 2 of 7Ver. 1.0
Developing Web Applications Using ASP.NET
Problem Statement:
You are a developer in the Adventure Works organization, a
fictitious bicycle manufacturer. You have been asked to assist
in the development of the Business-to-Consumer (B2C) Web
application and a related Business-to-Employee (B2E) extranet
portal.
Decisions on the design of the application have already been
made. You have been asked to carry out a number of specific
tasks in order to implement various elements of this design.
Demo: Accessing and Displaying Data
Slide 3 of 7Ver. 1.0
Developing Web Applications Using ASP.NET
As part of the first phase of the B2C development, you have
been asked to implement prototypes of pages that display and
manipulate data from the AdventureWorks database.You have
also been asked to implement prototypes of pages that display
and manipulate data from custom object data sources and
XML data from the TrailReport Web service.
Demo: Accessing and Displaying Data (Contd.)
Slide 4 of 7Ver. 1.0
Developing Web Applications Using ASP.NET
Solution:
To solve this problem, you need to perform following tasks:
1. Create and Retrieve Database Connections
a. Add a connection string for the AdventureWorks database to the
Web.Config file.
b. Programmatically retrieve the connection to the AdventureWorks
database.
c. Programmatically open the connection and verify that it is open.
d. Test the database connectivity.
Demo: Accessing and Displaying Data (Contd.)
Slide 5 of 7Ver. 1.0
Developing Web Applications Using ASP.NET
2. Access Data by Using SqlDataSource Controls and Data Controls
a. Add a SqlDataSource control to the Products page.
b. Set connection properties for the SqlDataSource control.
c. Bind a DropDownList control to the SqlDataSource control.
d. Add and configure a Subcategories GridView control with an
associated SqlDataSource control.
e. Define the columns for the gvwSubcategories control.
f. Add and configure a Products GridView control and associated
SqlDataSource control.
g. Define columns and templates for the gvwProduct GridView control.
h. Add and configure a Product Details DetailsView control and
associated SqlDataSource control.
i. Add a DataList control to the ProductDetails.aspx page.
j. Add an SqlDataSourceControl to the page.
k. Run and test the Web application.
Demo: Accessing and Displaying Data (Contd.)
Slide 6 of 7Ver. 1.0
Developing Web Applications Using ASP.NET
3. Access Objects as Data with ObjectDataSource Controls
a. Review the data-access code in the business object.
b. Configure an ObjectDataSource control for business-data access.
c. Add and configure a FormView control.
d. Define the EmptyDataTemplate element for the FormView control.
e. Define the ItemTemplate element for the FormView control.
f. Define the InsertItemTemplate element for the FormView control.
g. Add code to the Inserting event of the FormView control.
h. Run and test the Web application.
Demo: Accessing and Displaying Data (Contd.)
Slide 7 of 7Ver. 1.0
Developing Web Applications Using ASP.NET
4. Access XML Data by Using XmlDataSource Controls
a. Add an XmlDataSource object to the TrailReport.aspx page.
b. Add and configure a TreeView control for the TrailReport.aspx page.
c. Add code to an event procedure for the TreeView control.
d. Add code for the Page_Load event of the TrailReport.aspx page.
e. Test the XML data handling of the Web application.
Demo: Accessing and Displaying Data (Contd.)

More Related Content

PPSX
07 asp.net session10
PPS
07 asp.net session10
PDF
Step by Step Asp.Net GridView Tutorials
DOCX
Sql connected architecture
PPTX
Introducing Visual Studio LightSwitch(Screen Demo)
PPT
Using And Extending The DotNetNuke Widget Framework
PDF
Getting started-with-qlikview-part-i
07 asp.net session10
07 asp.net session10
Step by Step Asp.Net GridView Tutorials
Sql connected architecture
Introducing Visual Studio LightSwitch(Screen Demo)
Using And Extending The DotNetNuke Widget Framework
Getting started-with-qlikview-part-i

Viewers also liked (6)

PPTX
PPTX
PPTX
PPTX
PPTX
PPT
Data controls ppt
Data controls ppt
Ad

Similar to 07 asp.net session10 (20)

PPS
06 asp.net session08
PPSX
06 asp.net session08
PPS
06 asp.net session08
PDF
Asp.net
PPTX
Ch 7 data binding
PPTX
ASP.NET Lecture 4
PDF
ASP NET Professional Projects 1st Edition Hersh Bhasin
PDF
ASP NET Professional Projects 1st Edition Hersh Bhasin
PDF
Asp.net brochure
DOC
java Developing using asp.net
PDF
ASP NET Professional Projects 1st Edition Hersh Bhasin
PDF
Programming Microsoft SQL Server 2000 with Microsoft Visual Basic NET 1st edi...
PDF
Certified ASP.Net Programmer
PDF
Database Programming With Visual Basic Net And Adonet Tips Tutorials And Code...
DOCX
unit 3.docx
PDF
Asp.net
PPS
16 asp.net session23
PDF
Asp.net Programmer Certification
PPT
Asp db
06 asp.net session08
06 asp.net session08
06 asp.net session08
Asp.net
Ch 7 data binding
ASP.NET Lecture 4
ASP NET Professional Projects 1st Edition Hersh Bhasin
ASP NET Professional Projects 1st Edition Hersh Bhasin
Asp.net brochure
java Developing using asp.net
ASP NET Professional Projects 1st Edition Hersh Bhasin
Programming Microsoft SQL Server 2000 with Microsoft Visual Basic NET 1st edi...
Certified ASP.Net Programmer
Database Programming With Visual Basic Net And Adonet Tips Tutorials And Code...
unit 3.docx
Asp.net
16 asp.net session23
Asp.net Programmer Certification
Asp db
Ad

More from Mani Chaubey (6)

PPS
08 asp.net session11
PPS
05 asp.net session07
PPS
04 asp.net session05
PPS
03 asp.net session04
PPS
02 asp.net session02
PPS
01 asp.net session01
08 asp.net session11
05 asp.net session07
04 asp.net session05
03 asp.net session04
02 asp.net session02
01 asp.net session01

07 asp.net session10

  • 1. Slide 1 of 7Ver. 1.0 Developing Web Applications Using ASP.NET In this session, you will learn to: Create and retrieve database connections by using the Web.Config file Access relational data by using the SqlDataSource control and data controls Access XML data by using the XmlDataSource control and data controls Access objects as data by using the ObjectDataSource control and data controls Objectives
  • 2. Slide 2 of 7Ver. 1.0 Developing Web Applications Using ASP.NET Problem Statement: You are a developer in the Adventure Works organization, a fictitious bicycle manufacturer. You have been asked to assist in the development of the Business-to-Consumer (B2C) Web application and a related Business-to-Employee (B2E) extranet portal. Decisions on the design of the application have already been made. You have been asked to carry out a number of specific tasks in order to implement various elements of this design. Demo: Accessing and Displaying Data
  • 3. Slide 3 of 7Ver. 1.0 Developing Web Applications Using ASP.NET As part of the first phase of the B2C development, you have been asked to implement prototypes of pages that display and manipulate data from the AdventureWorks database.You have also been asked to implement prototypes of pages that display and manipulate data from custom object data sources and XML data from the TrailReport Web service. Demo: Accessing and Displaying Data (Contd.)
  • 4. Slide 4 of 7Ver. 1.0 Developing Web Applications Using ASP.NET Solution: To solve this problem, you need to perform following tasks: 1. Create and Retrieve Database Connections a. Add a connection string for the AdventureWorks database to the Web.Config file. b. Programmatically retrieve the connection to the AdventureWorks database. c. Programmatically open the connection and verify that it is open. d. Test the database connectivity. Demo: Accessing and Displaying Data (Contd.)
  • 5. Slide 5 of 7Ver. 1.0 Developing Web Applications Using ASP.NET 2. Access Data by Using SqlDataSource Controls and Data Controls a. Add a SqlDataSource control to the Products page. b. Set connection properties for the SqlDataSource control. c. Bind a DropDownList control to the SqlDataSource control. d. Add and configure a Subcategories GridView control with an associated SqlDataSource control. e. Define the columns for the gvwSubcategories control. f. Add and configure a Products GridView control and associated SqlDataSource control. g. Define columns and templates for the gvwProduct GridView control. h. Add and configure a Product Details DetailsView control and associated SqlDataSource control. i. Add a DataList control to the ProductDetails.aspx page. j. Add an SqlDataSourceControl to the page. k. Run and test the Web application. Demo: Accessing and Displaying Data (Contd.)
  • 6. Slide 6 of 7Ver. 1.0 Developing Web Applications Using ASP.NET 3. Access Objects as Data with ObjectDataSource Controls a. Review the data-access code in the business object. b. Configure an ObjectDataSource control for business-data access. c. Add and configure a FormView control. d. Define the EmptyDataTemplate element for the FormView control. e. Define the ItemTemplate element for the FormView control. f. Define the InsertItemTemplate element for the FormView control. g. Add code to the Inserting event of the FormView control. h. Run and test the Web application. Demo: Accessing and Displaying Data (Contd.)
  • 7. Slide 7 of 7Ver. 1.0 Developing Web Applications Using ASP.NET 4. Access XML Data by Using XmlDataSource Controls a. Add an XmlDataSource object to the TrailReport.aspx page. b. Add and configure a TreeView control for the TrailReport.aspx page. c. Add code to an event procedure for the TreeView control. d. Add code for the Page_Load event of the TrailReport.aspx page. e. Test the XML data handling of the Web application. Demo: Accessing and Displaying Data (Contd.)