SlideShare a Scribd company logo
1 of 26
Developing Web Applications Using ASP.NET
In this session, you will learn to:
Configure ViewState properties and ControlState properties for
Web server controls
Store and retrieve Application and Session state data
Implement out-of-process session state
Store and manage state data in the Cache object
Explain how to store and retrieve database connections by
using the Web.Config file
Explain how to use data source controls to access relational
data
Explain how to use data source controls to access XML data
Explain how to use data source controls to access object data
Objectives
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. As part of the first phase of the B2C development, you
have been asked to configure the behavior of Web server
controls by manipulating their ViewState properties. You have
also been asked to add a site-counter to the site, which will
display user numbers and store data in the Application and
Session objects.
Demo: Managing State for a Web Application
Developing Web Applications Using ASP.NET
You will also specify how the Web application stores and
manages session state data. Finally, you have been asked to
implement caching by using the Cache object to store bike
review data.
Demo: Managing State for a Web Application (Contd.)
Developing Web Applications Using ASP.NET
Solution:
To solve this problem, you need to perform the following tasks:
1. Configuring ViewState Properties for Web Server Controls
a. Open the Adventure Works Web site.
b. Set the EnableViewState property of Web server controls.
c. Test the ViewState after a Web page is submitted.
d. Disable ViewState for the BikeReview.aspx page.
e. Work with the MaxPageStateFieldLength property to divide the
ViewState data into chunks.
2. Storing and Retrieving Application and Session State
a. Initialize information in the Application object.
b. Write code to increment the UserCount value when a new user session
begins.
c. Store Data in the Session object.
d. Retrieve Application and Session state data and display it on the Web
page.
Demo: Managing State for a Web Application (Contd.)
Developing Web Applications Using ASP.NET
3. Implementing Out-of-Process Session State
a. Enable users to save their favorite trails in Session data.
b. Configure IIS, and then test the application.
c. Enable StateServer session management.
d. Enable SQLServer session management.
4. Storing and Managing State Data in the Cache Object
a. Store data and retrieve data from the Cache object.
b. Define dependencies between items in the Cache object.
c. Delete invalid cached data.
d. Implement Change Notifications in cached data to ensure that deleted
items are reloaded into the cache.
Demo: Managing State for a Web Application (Contd.)
Developing Web Applications Using ASP.NET
Database Connections and Connection Strings:
Web applications use database connections as the underlying
mechanism to perform various operations on the databases.
Database connections are defined in terms of a string that
specifies the properties of the connection.
Different databases support different properties and therefore
require different connection strings.
Database Connections and the Web.Config File
Developing Web Applications Using ASP.NET
Using the Web.config File to Simplify Connection String
Management:
Connection strings can be hard coded into the Web application
pages.
This approach is difficult to manage because databases may
be moved, redefined, or upgraded.
This problem can be solved by using the Web.Config file to
store the connection strings.
This approach retrieves the details of connection strings at run
time from the Web.config file.
Database Connections and the Web.Config File (Contd.)
Developing Web Applications Using ASP.NET
This sample code shows part of a Web.Config file with a
connection string:
<connectionStrings>
<add name="AdvWorks"
connectionString="Server=MySQLSever;
Database=AdventureWorks;
Integrated Security=SSPI;Persist Security
Info=True"
providerName="System.Data.SqlClient"/>
</connectionStrings>
Database Connections and the Web.Config File (Contd.)
Developing Web Applications Using ASP.NET
Retrieving Connection Strings at Run Time:
Connection string stored in the connectionStrings section
of the Web.Config file, can be retrieved at run time.
ConnectionStrings collection of ConfigurationManager
class is used to retrieve such connection string.
This sample code shows how to retrieve connection strings at
run time and how to use them to open a database connection:
string myDataString =
ConfigurationManager.ConnectionStrings["AdvWorks"].
ConnectionString;
System.Data.SqlClient.SqlConnection sqlConn =
new System.Data.SqlClient.SqlConnection
(myDataString);
sqlConn.Open();
Database Connections and the Web.Config File (Contd.)
Developing Web Applications Using ASP.NET
Data Source Controls:
A data source control pulls together all the elements of
connecting to a database to retrieve or manipulate data.
These elements includes:
Provider
Connection string
Query
Example: SqlDataSource control
<asp:SqlDataSource ID="SqlDataSource1"
Runat="server"
SelectCommand="SELECT * from Customers"
ConnectionString="<%$
ConnectionStrings:AppConnString%>"
ProviderName="<%$
ConnectionStrings:AppConnString.ProviderName %>"/>
Database Connections and the Web.Config File (Contd.)
Developing Web Applications Using ASP.NET
Accessing Relational Databases by Using Data Source
Controls:
Data source controls are provided for accessing the data
stored in relational databases.
Relational data source controls provide standard database
functionality for any type of database used. This functionality
includes:
Retrieval of data
Insertion of new data
Updating of existing data
Deletion of data
Relational Data and Data Source Controls
Developing Web Applications Using ASP.NET
The basic process of displaying data from relational
databases on a Web page is:
1. Add a data source control to the Web page, and then
configure it to connect to the required database.
2. Specify the SELECT statement in the SelectCommand
property of the data source control, to retrieve the data.
3. Bind data controls or data-aware controls to the data source
control.
If application has complex data access requirements, it may
not be feasible to use a data source control.
In such a case, data access can be coded by the
programmer by using ADO.NET classes.
Relational Data and Data Source Controls (Contd.)
Developing Web Applications Using ASP.NET
Providers:
A provider is a class that can communicate with a specific type
of database or data store.
ASP.NET provides a number of providers that can
communicate with a wide variety of data stores.
The providers include, the .NET framework data provider for:
SQL server in the System.Data.SqlClient namespace
OLE DB in the System.Data.OleDb namespace
ODBC in the System.Data.Odbc namespace
Oracle in the System.Data.OracleClient namespace
Relational Data and Data Source Controls (Contd.)
Developing Web Applications Using ASP.NET
Format of returned Data:
SqlDataSource control can return data in two forms:
DataSet
Data reader
Any of the above forms can be selected by setting
DataSourceMode property of the data source control.
DataSet:
Allows users to manipulate data after retrieving it.
Is used when a user want to filter, sort, or page through data after
retrieving it.
Data reader:
Provides a read-only cursor that can fetch individual records.
Is used to return and load the data into a control on the page.
Relational Data and Data Source Controls (Contd.)
Developing Web Applications Using ASP.NET
Caching:
The SqlDataSource control can cache data that it has
retrieved.
Caching can be enabled by setting EnableCaching to
true.
CacheDuration property can be set to specify the number
of seconds to cache data.
Cache dependency feature of SQL Server can also be used
by SqlDataSource control.
By using cache dependency, retrieval of data can be
minimized.
Relational Data and Data Source Controls (Contd.)
Developing Web Applications Using ASP.NET
Sorting and Filtering:
The SqlDataSource control can be used to filter the data
without rerunning the query, provided you have:
Cached the data
Specified DataSet as the format of the returned data
FilterExpression property of SqlDataSource control
can be used to specify the selection criteria that are applied to
the data maintained by the data source control.
Filter expression can be parameterized by creating special
FilterParameters objects.
Relational Data and Data Source Controls (Contd.)
Developing Web Applications Using ASP.NET
Data source controls provide the following properties:
SelectCommand
UpdateCommand
InsertCommand
DeleteCommand
To enable data editing in a Web page, templates with
editable controls can be defined for the data controls.
Button controls with specific CommandName arguments can
be included to invoke specific data operations.
Relational Data and Data Source Controls (Contd.)
Developing Web Applications Using ASP.NET
Templates for data controls:
To use the FormView control to display data from a database
on a Web page:
Create an ItemTemplate element between the opening and closing
tags of the FormView control.
Include static label controls and the necessary markup to bind the
static label controls to the fields in the data source as:
<ItemTemplate>
<b>Product ID: </b>
<asp:Label ID="lblProductID" runat="server" Text=
'<%# Eval("ProductID") %>'>
</asp:Label><br/>
<b>Product Name:</b>
<asp:Label ID="lblProductName" runat="server"
Text='<%# Eval("ProductName") %>'>
</asp:Label><br/>
<asp:Button ID="btnAdd" Text="Add review“
CommandName="New“ runat="server" />
</ItemTemplate>
Relational Data and Data Source Controls (Contd.)
Developing Web Applications Using ASP.NET
To use the FormView control to add new data :
Create an InsertItemTemplate element between the opening and
closing tags of the FormView control.
Include editable controls and the necessary markup to bind the
controls to the fields in the data source as:
<InsertItemTemplate>
<table width="100%">
<tr> <td> Product: </td>
<td> <% =Request.QueryString["ProductID"]%></td>
</tr>
<tr> <td> Product Name: </td>
<td> <asp:TextBox
ID="txtProductName"
runat="server" Text='<%#
Bind("ProductName") %>' />
</td>
</tr>
Relational Data and Data Source Controls (Contd.)
Developing Web Applications Using ASP.NET
<tr>
<td>
<asp:Button ID="btnInsert" runat="server"
CommandName="Insert" Text="Save"/>
</td>
<td>
<asp:Button ID="btnCancel" runat="server"
CommandName="Cancel" Text="Cancel"/>
</td>
</tr>
</table>
</InsertItemTemplate>
Relational Data and Data Source Controls (Contd.)
Developing Web Applications Using ASP.NET
XMLDataSource control is provided for accessing XML
data.
This control can be configured to retrieve data from:
XML files
Web services that return XML data
String variables that contain XML data
In-memory XMLDataDocument objects
XML data retrieved by the XMLDataSource control is read
only.
XML Data and Data Source Controls
Developing Web Applications Using ASP.NET
The basic process for displaying XML data on Web pages
is:
1. Add an XmlDataSource control to the Web page, and
configure it to connect to the required XML source.
2. Bind data-aware controls that are capable of displaying XML
data to the XmlDataSource control.
TreeView control and Xml control are example of controls
that are capable of displaying XML data.
XML Data and Data Source Controls (Contd.)
Developing Web Applications Using ASP.NET
ObjectDataSource controls are provided for accessing
the data managed by business objects.
The functionality of the business object defines the
functionality of the ObjectDataSource control.
The basic process for displaying data from business objects
on the Web pages is:
1. Add an ObjectDataSource control to the Web page, and
then configure it to connect to the required business object.
2. Specify the name of the method used to retrieve data from the
business object in the SelectMethod property.
3. Bind data controls or data-aware controls to the data source
control.
Object Data and Data Source Controls
Developing Web Applications Using ASP.NET
ObjectDataSource controls support the following
properties:
SelectMethod
UpdateMethod
InsertMethod
DeleteMethod
Object Data and Data Source Controls (Contd.)
Developing Web Applications Using ASP.NET
In this session, you learned that:
Database connections are defined in terms of a string that
specifies the properties of the connection.
Using Web.config file is a better approach than hard-coding the
connection string in a Web application.
Web page retrieves the details of the connection string at the
run time from the Web.Config file.
ConfigurationManager class is used to retrieve the
connection string at run time.
Data source controls are provided to access the data stored in
a relational database.
Data source controls can select, update, insert, and delete
data from a relational database.
Summary
Developing Web Applications Using ASP.NET
XMLDataSource control is provided for accessing XML data.
XMLDataSource control provides read-only access to the
XML data.
ObjectDataSource control provides access to the data
managed by business objects.
ObjectDataSource control can display, update, insert, and
delete object data, provided the underlying object supports
these functionalities.
Summary (Contd.)

More Related Content

What's hot

Detail view in distributed technologies
Detail view in distributed technologiesDetail view in distributed technologies
Detail view in distributed technologiesjamessakila
 
ASP.NET 10 - Data Controls
ASP.NET 10 - Data ControlsASP.NET 10 - Data Controls
ASP.NET 10 - Data ControlsRandy Connolly
 
ADO .NET by Sonu Vishwakarma
ADO .NET by Sonu VishwakarmaADO .NET by Sonu Vishwakarma
ADO .NET by Sonu VishwakarmaSonu Vishwakarma
 
ASP.NET Lecture 2
ASP.NET Lecture 2ASP.NET Lecture 2
ASP.NET Lecture 2Julie Iskander
 
Web based database application design using vb.net and sql server
Web based database application design using vb.net and sql serverWeb based database application design using vb.net and sql server
Web based database application design using vb.net and sql serverAmmara Arooj
 
Data controls ppt
Data controls pptData controls ppt
Data controls pptIblesoft
 
Auditing Data Access in SQL Server
Auditing Data Access in SQL ServerAuditing Data Access in SQL Server
Auditing Data Access in SQL ServerAntonios Chatzipavlis
 
ADO.NET -database connection
ADO.NET -database connectionADO.NET -database connection
ADO.NET -database connectionAnekwong Yoddumnern
 
Online SAP BO 4.2 Training
Online SAP BO 4.2 TrainingOnline SAP BO 4.2 Training
Online SAP BO 4.2 Trainingashok training
 
Training BOBJ SAP Online
Training BOBJ SAP OnlineTraining BOBJ SAP Online
Training BOBJ SAP Onlineashok training
 
ASP.NET lecture 8
ASP.NET lecture 8ASP.NET lecture 8
ASP.NET lecture 8Julie Iskander
 

What's hot (17)

Detail view in distributed technologies
Detail view in distributed technologiesDetail view in distributed technologies
Detail view in distributed technologies
 
ASP.NET 10 - Data Controls
ASP.NET 10 - Data ControlsASP.NET 10 - Data Controls
ASP.NET 10 - Data Controls
 
ADO .NET by Sonu Vishwakarma
ADO .NET by Sonu VishwakarmaADO .NET by Sonu Vishwakarma
ADO .NET by Sonu Vishwakarma
 
Database Connection
Database ConnectionDatabase Connection
Database Connection
 
Chapter12 (1)
Chapter12 (1)Chapter12 (1)
Chapter12 (1)
 
Synopsis
SynopsisSynopsis
Synopsis
 
ASP.NET Lecture 2
ASP.NET Lecture 2ASP.NET Lecture 2
ASP.NET Lecture 2
 
Web based database application design using vb.net and sql server
Web based database application design using vb.net and sql serverWeb based database application design using vb.net and sql server
Web based database application design using vb.net and sql server
 
Data controls ppt
Data controls pptData controls ppt
Data controls ppt
 
Asp.net
Asp.netAsp.net
Asp.net
 
Ado .net
Ado .netAdo .net
Ado .net
 
Vb & asp .net
Vb & asp .netVb & asp .net
Vb & asp .net
 
Auditing Data Access in SQL Server
Auditing Data Access in SQL ServerAuditing Data Access in SQL Server
Auditing Data Access in SQL Server
 
ADO.NET -database connection
ADO.NET -database connectionADO.NET -database connection
ADO.NET -database connection
 
Online SAP BO 4.2 Training
Online SAP BO 4.2 TrainingOnline SAP BO 4.2 Training
Online SAP BO 4.2 Training
 
Training BOBJ SAP Online
Training BOBJ SAP OnlineTraining BOBJ SAP Online
Training BOBJ SAP Online
 
ASP.NET lecture 8
ASP.NET lecture 8ASP.NET lecture 8
ASP.NET lecture 8
 

Viewers also liked

STUDY: Website Vulnerability Assessment
STUDY: Website Vulnerability AssessmentSTUDY: Website Vulnerability Assessment
STUDY: Website Vulnerability AssessmentSymantec
 
Web Vulnerabilities_NGAN Seok Chern
Web Vulnerabilities_NGAN Seok ChernWeb Vulnerabilities_NGAN Seok Chern
Web Vulnerabilities_NGAN Seok ChernQuek Lilian
 
15 Years of Web Security: The Rebellious Teenage Years
15 Years of Web Security: The Rebellious Teenage Years15 Years of Web Security: The Rebellious Teenage Years
15 Years of Web Security: The Rebellious Teenage YearsJeremiah Grossman
 
JavaScript Security
JavaScript SecurityJavaScript Security
JavaScript SecurityJason Harwig
 
Statistics - Top Website Vulnerabilities
Statistics - Top Website VulnerabilitiesStatistics - Top Website Vulnerabilities
Statistics - Top Website VulnerabilitiesJeremiah Grossman
 
Secure development automatic identification and mitigation of application v...
Secure development   automatic identification and mitigation of application v...Secure development   automatic identification and mitigation of application v...
Secure development automatic identification and mitigation of application v...peihsin1980
 
Slideshare.Com Powerpoint
Slideshare.Com PowerpointSlideshare.Com Powerpoint
Slideshare.Com Powerpointguested929b
 

Viewers also liked (8)

STUDY: Website Vulnerability Assessment
STUDY: Website Vulnerability AssessmentSTUDY: Website Vulnerability Assessment
STUDY: Website Vulnerability Assessment
 
Cyber Security Predictions 2016
Cyber Security Predictions 2016Cyber Security Predictions 2016
Cyber Security Predictions 2016
 
Web Vulnerabilities_NGAN Seok Chern
Web Vulnerabilities_NGAN Seok ChernWeb Vulnerabilities_NGAN Seok Chern
Web Vulnerabilities_NGAN Seok Chern
 
15 Years of Web Security: The Rebellious Teenage Years
15 Years of Web Security: The Rebellious Teenage Years15 Years of Web Security: The Rebellious Teenage Years
15 Years of Web Security: The Rebellious Teenage Years
 
JavaScript Security
JavaScript SecurityJavaScript Security
JavaScript Security
 
Statistics - Top Website Vulnerabilities
Statistics - Top Website VulnerabilitiesStatistics - Top Website Vulnerabilities
Statistics - Top Website Vulnerabilities
 
Secure development automatic identification and mitigation of application v...
Secure development   automatic identification and mitigation of application v...Secure development   automatic identification and mitigation of application v...
Secure development automatic identification and mitigation of application v...
 
Slideshare.Com Powerpoint
Slideshare.Com PowerpointSlideshare.Com Powerpoint
Slideshare.Com Powerpoint
 

Similar to 06 asp.net session08

06 asp.net session08
06 asp.net session0806 asp.net session08
06 asp.net session08Niit Care
 
05 asp.net session07
05 asp.net session0705 asp.net session07
05 asp.net session07Mani Chaubey
 
Ch05 state management
Ch05 state managementCh05 state management
Ch05 state managementMadhuri Kavade
 
Ch 7 data binding
Ch 7 data bindingCh 7 data binding
Ch 7 data bindingMadhuri Kavade
 
07 asp.net session10
07 asp.net session1007 asp.net session10
07 asp.net session10Niit Care
 
Asp Net Advance Topics
Asp Net Advance TopicsAsp Net Advance Topics
Asp Net Advance TopicsAli Taki
 
07 asp.net session10
07 asp.net session1007 asp.net session10
07 asp.net session10Vivek chan
 
11 asp.net session16
11 asp.net session1611 asp.net session16
11 asp.net session16Vivek chan
 
State management
State managementState management
State managementteach4uin
 
MICROSOFT ASP.NET ONLINE TRAINING
MICROSOFT ASP.NET ONLINE TRAININGMICROSOFT ASP.NET ONLINE TRAINING
MICROSOFT ASP.NET ONLINE TRAININGtraining3
 
MICROSOFT ASP.NET ONLINE TRAINING
MICROSOFT ASP.NET ONLINE TRAININGMICROSOFT ASP.NET ONLINE TRAINING
MICROSOFT ASP.NET ONLINE TRAININGSanthosh Sap
 
MICROSOFT ASP.NET ONLINE TRAINING
MICROSOFT ASP.NET ONLINE TRAININGMICROSOFT ASP.NET ONLINE TRAINING
MICROSOFT ASP.NET ONLINE TRAININGsapcrmtraining
 
MICROSOFT ASP.NET ONLINE TRAINING
MICROSOFT ASP.NET ONLINE TRAININGMICROSOFT ASP.NET ONLINE TRAINING
MICROSOFT ASP.NET ONLINE TRAININGSanthosh Sap
 
Microsoft asp.net online training
Microsoft asp.net online trainingMicrosoft asp.net online training
Microsoft asp.net online trainingSanthosh Reddy
 
New Features Of ASP.Net 4 0
New Features Of ASP.Net 4 0New Features Of ASP.Net 4 0
New Features Of ASP.Net 4 0Dima Maleev
 
Microsoft asp.net online training
Microsoft asp.net online trainingMicrosoft asp.net online training
Microsoft asp.net online trainingtraining3
 
Microsoft asp.net online training
Microsoft asp.net online trainingMicrosoft asp.net online training
Microsoft asp.net online trainingtraining13acutesoft
 
Work with data in ASP.NET
Work with data in ASP.NETWork with data in ASP.NET
Work with data in ASP.NETPeter Gfader
 

Similar to 06 asp.net session08 (20)

06 asp.net session08
06 asp.net session0806 asp.net session08
06 asp.net session08
 
05 asp.net session07
05 asp.net session0705 asp.net session07
05 asp.net session07
 
2310 b 15
2310 b 152310 b 15
2310 b 15
 
2310 b 15
2310 b 152310 b 15
2310 b 15
 
Ch05 state management
Ch05 state managementCh05 state management
Ch05 state management
 
Ch 7 data binding
Ch 7 data bindingCh 7 data binding
Ch 7 data binding
 
07 asp.net session10
07 asp.net session1007 asp.net session10
07 asp.net session10
 
Asp Net Advance Topics
Asp Net Advance TopicsAsp Net Advance Topics
Asp Net Advance Topics
 
07 asp.net session10
07 asp.net session1007 asp.net session10
07 asp.net session10
 
11 asp.net session16
11 asp.net session1611 asp.net session16
11 asp.net session16
 
State management
State managementState management
State management
 
MICROSOFT ASP.NET ONLINE TRAINING
MICROSOFT ASP.NET ONLINE TRAININGMICROSOFT ASP.NET ONLINE TRAINING
MICROSOFT ASP.NET ONLINE TRAINING
 
MICROSOFT ASP.NET ONLINE TRAINING
MICROSOFT ASP.NET ONLINE TRAININGMICROSOFT ASP.NET ONLINE TRAINING
MICROSOFT ASP.NET ONLINE TRAINING
 
MICROSOFT ASP.NET ONLINE TRAINING
MICROSOFT ASP.NET ONLINE TRAININGMICROSOFT ASP.NET ONLINE TRAINING
MICROSOFT ASP.NET ONLINE TRAINING
 
MICROSOFT ASP.NET ONLINE TRAINING
MICROSOFT ASP.NET ONLINE TRAININGMICROSOFT ASP.NET ONLINE TRAINING
MICROSOFT ASP.NET ONLINE TRAINING
 
Microsoft asp.net online training
Microsoft asp.net online trainingMicrosoft asp.net online training
Microsoft asp.net online training
 
New Features Of ASP.Net 4 0
New Features Of ASP.Net 4 0New Features Of ASP.Net 4 0
New Features Of ASP.Net 4 0
 
Microsoft asp.net online training
Microsoft asp.net online trainingMicrosoft asp.net online training
Microsoft asp.net online training
 
Microsoft asp.net online training
Microsoft asp.net online trainingMicrosoft asp.net online training
Microsoft asp.net online training
 
Work with data in ASP.NET
Work with data in ASP.NETWork with data in ASP.NET
Work with data in ASP.NET
 

More from Vivek chan

Deceptive Marketing.pdf
Deceptive Marketing.pdfDeceptive Marketing.pdf
Deceptive Marketing.pdfVivek chan
 
brain controled wheel chair.pdf
brain controled wheel chair.pdfbrain controled wheel chair.pdf
brain controled wheel chair.pdfVivek chan
 
Mechanism of fullerene synthesis in the ARC REACTOR (Vivek Chan 2013)
Mechanism of fullerene synthesis in the ARC REACTOR (Vivek Chan 2013)Mechanism of fullerene synthesis in the ARC REACTOR (Vivek Chan 2013)
Mechanism of fullerene synthesis in the ARC REACTOR (Vivek Chan 2013)Vivek chan
 
Manav dharma shashtra tatha shashan paddati munshiram jigyasu
Manav dharma shashtra tatha shashan paddati   munshiram jigyasuManav dharma shashtra tatha shashan paddati   munshiram jigyasu
Manav dharma shashtra tatha shashan paddati munshiram jigyasuVivek chan
 
Self driving and connected cars fooling sensors and tracking drivers
Self driving and connected cars fooling sensors and tracking driversSelf driving and connected cars fooling sensors and tracking drivers
Self driving and connected cars fooling sensors and tracking driversVivek chan
 
EEG Acquisition Device to Control Wheelchair Using Thoughts
EEG Acquisition Device to Control Wheelchair Using ThoughtsEEG Acquisition Device to Control Wheelchair Using Thoughts
EEG Acquisition Device to Control Wheelchair Using ThoughtsVivek chan
 
Vivek Chan | Technology Consultant
Vivek Chan | Technology Consultant Vivek Chan | Technology Consultant
Vivek Chan | Technology Consultant Vivek chan
 
Vivek Chan | Technology Consultant
Vivek Chan | Technology Consultant Vivek Chan | Technology Consultant
Vivek Chan | Technology Consultant Vivek chan
 
Full Shri Ramcharitmanas in Hindi Complete With Meaning (Ramayana)
Full Shri Ramcharitmanas in Hindi Complete With Meaning (Ramayana)Full Shri Ramcharitmanas in Hindi Complete With Meaning (Ramayana)
Full Shri Ramcharitmanas in Hindi Complete With Meaning (Ramayana)Vivek chan
 
Net framework session01
Net framework session01Net framework session01
Net framework session01Vivek chan
 
Net framework session03
Net framework session03Net framework session03
Net framework session03Vivek chan
 
Net framework session02
Net framework session02Net framework session02
Net framework session02Vivek chan
 
04 intel v_tune_session_05
04 intel v_tune_session_0504 intel v_tune_session_05
04 intel v_tune_session_05Vivek chan
 
03 intel v_tune_session_04
03 intel v_tune_session_0403 intel v_tune_session_04
03 intel v_tune_session_04Vivek chan
 
02 intel v_tune_session_02
02 intel v_tune_session_0202 intel v_tune_session_02
02 intel v_tune_session_02Vivek chan
 
01 intel v_tune_session_01
01 intel v_tune_session_0101 intel v_tune_session_01
01 intel v_tune_session_01Vivek chan
 
09 intel v_tune_session_13
09 intel v_tune_session_1309 intel v_tune_session_13
09 intel v_tune_session_13Vivek chan
 
07 intel v_tune_session_10
07 intel v_tune_session_1007 intel v_tune_session_10
07 intel v_tune_session_10Vivek chan
 
02 asp.net session02
02 asp.net session0202 asp.net session02
02 asp.net session02Vivek chan
 
01 asp.net session01
01 asp.net session0101 asp.net session01
01 asp.net session01Vivek chan
 

More from Vivek chan (20)

Deceptive Marketing.pdf
Deceptive Marketing.pdfDeceptive Marketing.pdf
Deceptive Marketing.pdf
 
brain controled wheel chair.pdf
brain controled wheel chair.pdfbrain controled wheel chair.pdf
brain controled wheel chair.pdf
 
Mechanism of fullerene synthesis in the ARC REACTOR (Vivek Chan 2013)
Mechanism of fullerene synthesis in the ARC REACTOR (Vivek Chan 2013)Mechanism of fullerene synthesis in the ARC REACTOR (Vivek Chan 2013)
Mechanism of fullerene synthesis in the ARC REACTOR (Vivek Chan 2013)
 
Manav dharma shashtra tatha shashan paddati munshiram jigyasu
Manav dharma shashtra tatha shashan paddati   munshiram jigyasuManav dharma shashtra tatha shashan paddati   munshiram jigyasu
Manav dharma shashtra tatha shashan paddati munshiram jigyasu
 
Self driving and connected cars fooling sensors and tracking drivers
Self driving and connected cars fooling sensors and tracking driversSelf driving and connected cars fooling sensors and tracking drivers
Self driving and connected cars fooling sensors and tracking drivers
 
EEG Acquisition Device to Control Wheelchair Using Thoughts
EEG Acquisition Device to Control Wheelchair Using ThoughtsEEG Acquisition Device to Control Wheelchair Using Thoughts
EEG Acquisition Device to Control Wheelchair Using Thoughts
 
Vivek Chan | Technology Consultant
Vivek Chan | Technology Consultant Vivek Chan | Technology Consultant
Vivek Chan | Technology Consultant
 
Vivek Chan | Technology Consultant
Vivek Chan | Technology Consultant Vivek Chan | Technology Consultant
Vivek Chan | Technology Consultant
 
Full Shri Ramcharitmanas in Hindi Complete With Meaning (Ramayana)
Full Shri Ramcharitmanas in Hindi Complete With Meaning (Ramayana)Full Shri Ramcharitmanas in Hindi Complete With Meaning (Ramayana)
Full Shri Ramcharitmanas in Hindi Complete With Meaning (Ramayana)
 
Net framework session01
Net framework session01Net framework session01
Net framework session01
 
Net framework session03
Net framework session03Net framework session03
Net framework session03
 
Net framework session02
Net framework session02Net framework session02
Net framework session02
 
04 intel v_tune_session_05
04 intel v_tune_session_0504 intel v_tune_session_05
04 intel v_tune_session_05
 
03 intel v_tune_session_04
03 intel v_tune_session_0403 intel v_tune_session_04
03 intel v_tune_session_04
 
02 intel v_tune_session_02
02 intel v_tune_session_0202 intel v_tune_session_02
02 intel v_tune_session_02
 
01 intel v_tune_session_01
01 intel v_tune_session_0101 intel v_tune_session_01
01 intel v_tune_session_01
 
09 intel v_tune_session_13
09 intel v_tune_session_1309 intel v_tune_session_13
09 intel v_tune_session_13
 
07 intel v_tune_session_10
07 intel v_tune_session_1007 intel v_tune_session_10
07 intel v_tune_session_10
 
02 asp.net session02
02 asp.net session0202 asp.net session02
02 asp.net session02
 
01 asp.net session01
01 asp.net session0101 asp.net session01
01 asp.net session01
 

Recently uploaded

Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxChelloAnnAsuncion2
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
Romantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxRomantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxsqpmdrvczh
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxDr.Ibrahim Hassaan
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfphamnguyenenglishnb
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomnelietumpap1
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 

Recently uploaded (20)

Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
Romantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxRomantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptx
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptx
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choom
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
Rapple "Scholarly Communications and the Sustainable Development Goals"
Rapple "Scholarly Communications and the Sustainable Development Goals"Rapple "Scholarly Communications and the Sustainable Development Goals"
Rapple "Scholarly Communications and the Sustainable Development Goals"
 

06 asp.net session08

  • 1. Developing Web Applications Using ASP.NET In this session, you will learn to: Configure ViewState properties and ControlState properties for Web server controls Store and retrieve Application and Session state data Implement out-of-process session state Store and manage state data in the Cache object Explain how to store and retrieve database connections by using the Web.Config file Explain how to use data source controls to access relational data Explain how to use data source controls to access XML data Explain how to use data source controls to access object data Objectives
  • 2. 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. As part of the first phase of the B2C development, you have been asked to configure the behavior of Web server controls by manipulating their ViewState properties. You have also been asked to add a site-counter to the site, which will display user numbers and store data in the Application and Session objects. Demo: Managing State for a Web Application
  • 3. Developing Web Applications Using ASP.NET You will also specify how the Web application stores and manages session state data. Finally, you have been asked to implement caching by using the Cache object to store bike review data. Demo: Managing State for a Web Application (Contd.)
  • 4. Developing Web Applications Using ASP.NET Solution: To solve this problem, you need to perform the following tasks: 1. Configuring ViewState Properties for Web Server Controls a. Open the Adventure Works Web site. b. Set the EnableViewState property of Web server controls. c. Test the ViewState after a Web page is submitted. d. Disable ViewState for the BikeReview.aspx page. e. Work with the MaxPageStateFieldLength property to divide the ViewState data into chunks. 2. Storing and Retrieving Application and Session State a. Initialize information in the Application object. b. Write code to increment the UserCount value when a new user session begins. c. Store Data in the Session object. d. Retrieve Application and Session state data and display it on the Web page. Demo: Managing State for a Web Application (Contd.)
  • 5. Developing Web Applications Using ASP.NET 3. Implementing Out-of-Process Session State a. Enable users to save their favorite trails in Session data. b. Configure IIS, and then test the application. c. Enable StateServer session management. d. Enable SQLServer session management. 4. Storing and Managing State Data in the Cache Object a. Store data and retrieve data from the Cache object. b. Define dependencies between items in the Cache object. c. Delete invalid cached data. d. Implement Change Notifications in cached data to ensure that deleted items are reloaded into the cache. Demo: Managing State for a Web Application (Contd.)
  • 6. Developing Web Applications Using ASP.NET Database Connections and Connection Strings: Web applications use database connections as the underlying mechanism to perform various operations on the databases. Database connections are defined in terms of a string that specifies the properties of the connection. Different databases support different properties and therefore require different connection strings. Database Connections and the Web.Config File
  • 7. Developing Web Applications Using ASP.NET Using the Web.config File to Simplify Connection String Management: Connection strings can be hard coded into the Web application pages. This approach is difficult to manage because databases may be moved, redefined, or upgraded. This problem can be solved by using the Web.Config file to store the connection strings. This approach retrieves the details of connection strings at run time from the Web.config file. Database Connections and the Web.Config File (Contd.)
  • 8. Developing Web Applications Using ASP.NET This sample code shows part of a Web.Config file with a connection string: <connectionStrings> <add name="AdvWorks" connectionString="Server=MySQLSever; Database=AdventureWorks; Integrated Security=SSPI;Persist Security Info=True" providerName="System.Data.SqlClient"/> </connectionStrings> Database Connections and the Web.Config File (Contd.)
  • 9. Developing Web Applications Using ASP.NET Retrieving Connection Strings at Run Time: Connection string stored in the connectionStrings section of the Web.Config file, can be retrieved at run time. ConnectionStrings collection of ConfigurationManager class is used to retrieve such connection string. This sample code shows how to retrieve connection strings at run time and how to use them to open a database connection: string myDataString = ConfigurationManager.ConnectionStrings["AdvWorks"]. ConnectionString; System.Data.SqlClient.SqlConnection sqlConn = new System.Data.SqlClient.SqlConnection (myDataString); sqlConn.Open(); Database Connections and the Web.Config File (Contd.)
  • 10. Developing Web Applications Using ASP.NET Data Source Controls: A data source control pulls together all the elements of connecting to a database to retrieve or manipulate data. These elements includes: Provider Connection string Query Example: SqlDataSource control <asp:SqlDataSource ID="SqlDataSource1" Runat="server" SelectCommand="SELECT * from Customers" ConnectionString="<%$ ConnectionStrings:AppConnString%>" ProviderName="<%$ ConnectionStrings:AppConnString.ProviderName %>"/> Database Connections and the Web.Config File (Contd.)
  • 11. Developing Web Applications Using ASP.NET Accessing Relational Databases by Using Data Source Controls: Data source controls are provided for accessing the data stored in relational databases. Relational data source controls provide standard database functionality for any type of database used. This functionality includes: Retrieval of data Insertion of new data Updating of existing data Deletion of data Relational Data and Data Source Controls
  • 12. Developing Web Applications Using ASP.NET The basic process of displaying data from relational databases on a Web page is: 1. Add a data source control to the Web page, and then configure it to connect to the required database. 2. Specify the SELECT statement in the SelectCommand property of the data source control, to retrieve the data. 3. Bind data controls or data-aware controls to the data source control. If application has complex data access requirements, it may not be feasible to use a data source control. In such a case, data access can be coded by the programmer by using ADO.NET classes. Relational Data and Data Source Controls (Contd.)
  • 13. Developing Web Applications Using ASP.NET Providers: A provider is a class that can communicate with a specific type of database or data store. ASP.NET provides a number of providers that can communicate with a wide variety of data stores. The providers include, the .NET framework data provider for: SQL server in the System.Data.SqlClient namespace OLE DB in the System.Data.OleDb namespace ODBC in the System.Data.Odbc namespace Oracle in the System.Data.OracleClient namespace Relational Data and Data Source Controls (Contd.)
  • 14. Developing Web Applications Using ASP.NET Format of returned Data: SqlDataSource control can return data in two forms: DataSet Data reader Any of the above forms can be selected by setting DataSourceMode property of the data source control. DataSet: Allows users to manipulate data after retrieving it. Is used when a user want to filter, sort, or page through data after retrieving it. Data reader: Provides a read-only cursor that can fetch individual records. Is used to return and load the data into a control on the page. Relational Data and Data Source Controls (Contd.)
  • 15. Developing Web Applications Using ASP.NET Caching: The SqlDataSource control can cache data that it has retrieved. Caching can be enabled by setting EnableCaching to true. CacheDuration property can be set to specify the number of seconds to cache data. Cache dependency feature of SQL Server can also be used by SqlDataSource control. By using cache dependency, retrieval of data can be minimized. Relational Data and Data Source Controls (Contd.)
  • 16. Developing Web Applications Using ASP.NET Sorting and Filtering: The SqlDataSource control can be used to filter the data without rerunning the query, provided you have: Cached the data Specified DataSet as the format of the returned data FilterExpression property of SqlDataSource control can be used to specify the selection criteria that are applied to the data maintained by the data source control. Filter expression can be parameterized by creating special FilterParameters objects. Relational Data and Data Source Controls (Contd.)
  • 17. Developing Web Applications Using ASP.NET Data source controls provide the following properties: SelectCommand UpdateCommand InsertCommand DeleteCommand To enable data editing in a Web page, templates with editable controls can be defined for the data controls. Button controls with specific CommandName arguments can be included to invoke specific data operations. Relational Data and Data Source Controls (Contd.)
  • 18. Developing Web Applications Using ASP.NET Templates for data controls: To use the FormView control to display data from a database on a Web page: Create an ItemTemplate element between the opening and closing tags of the FormView control. Include static label controls and the necessary markup to bind the static label controls to the fields in the data source as: <ItemTemplate> <b>Product ID: </b> <asp:Label ID="lblProductID" runat="server" Text= '<%# Eval("ProductID") %>'> </asp:Label><br/> <b>Product Name:</b> <asp:Label ID="lblProductName" runat="server" Text='<%# Eval("ProductName") %>'> </asp:Label><br/> <asp:Button ID="btnAdd" Text="Add review“ CommandName="New“ runat="server" /> </ItemTemplate> Relational Data and Data Source Controls (Contd.)
  • 19. Developing Web Applications Using ASP.NET To use the FormView control to add new data : Create an InsertItemTemplate element between the opening and closing tags of the FormView control. Include editable controls and the necessary markup to bind the controls to the fields in the data source as: <InsertItemTemplate> <table width="100%"> <tr> <td> Product: </td> <td> <% =Request.QueryString["ProductID"]%></td> </tr> <tr> <td> Product Name: </td> <td> <asp:TextBox ID="txtProductName" runat="server" Text='<%# Bind("ProductName") %>' /> </td> </tr> Relational Data and Data Source Controls (Contd.)
  • 20. Developing Web Applications Using ASP.NET <tr> <td> <asp:Button ID="btnInsert" runat="server" CommandName="Insert" Text="Save"/> </td> <td> <asp:Button ID="btnCancel" runat="server" CommandName="Cancel" Text="Cancel"/> </td> </tr> </table> </InsertItemTemplate> Relational Data and Data Source Controls (Contd.)
  • 21. Developing Web Applications Using ASP.NET XMLDataSource control is provided for accessing XML data. This control can be configured to retrieve data from: XML files Web services that return XML data String variables that contain XML data In-memory XMLDataDocument objects XML data retrieved by the XMLDataSource control is read only. XML Data and Data Source Controls
  • 22. Developing Web Applications Using ASP.NET The basic process for displaying XML data on Web pages is: 1. Add an XmlDataSource control to the Web page, and configure it to connect to the required XML source. 2. Bind data-aware controls that are capable of displaying XML data to the XmlDataSource control. TreeView control and Xml control are example of controls that are capable of displaying XML data. XML Data and Data Source Controls (Contd.)
  • 23. Developing Web Applications Using ASP.NET ObjectDataSource controls are provided for accessing the data managed by business objects. The functionality of the business object defines the functionality of the ObjectDataSource control. The basic process for displaying data from business objects on the Web pages is: 1. Add an ObjectDataSource control to the Web page, and then configure it to connect to the required business object. 2. Specify the name of the method used to retrieve data from the business object in the SelectMethod property. 3. Bind data controls or data-aware controls to the data source control. Object Data and Data Source Controls
  • 24. Developing Web Applications Using ASP.NET ObjectDataSource controls support the following properties: SelectMethod UpdateMethod InsertMethod DeleteMethod Object Data and Data Source Controls (Contd.)
  • 25. Developing Web Applications Using ASP.NET In this session, you learned that: Database connections are defined in terms of a string that specifies the properties of the connection. Using Web.config file is a better approach than hard-coding the connection string in a Web application. Web page retrieves the details of the connection string at the run time from the Web.Config file. ConfigurationManager class is used to retrieve the connection string at run time. Data source controls are provided to access the data stored in a relational database. Data source controls can select, update, insert, and delete data from a relational database. Summary
  • 26. Developing Web Applications Using ASP.NET XMLDataSource control is provided for accessing XML data. XMLDataSource control provides read-only access to the XML data. ObjectDataSource control provides access to the data managed by business objects. ObjectDataSource control can display, update, insert, and delete object data, provided the underlying object supports these functionalities. Summary (Contd.)