ASP.NET 4.0
Julie Iskander
MSC. Communication and Electronics
Lecture Outlines
 Data Binding
 Rich Data Controls
 n-tier architecture
Data Binding
Programatic DataBinding
   Using Control Properties
    ◦ DataSource  a collection (a
      list, reader, dataset)
    ◦ DataTextField
    ◦ DataValueField
   Don’t forget to DataBind();
Declarative Data Binding
 Single-value Binding
 Repeated-value Binding
Single-Value Binding
 <%# expression goes here %>
 Expression can be:
    ◦ A function (must be protected, public)
    ◦ A property (must be protected, public)
    ◦ A string literal or an mathematical
      expression
 Bound to
  TextBox, Label, LinkButton,….etc
 Must call Page.DataBind() or
  Control.DataBind()
Repeated-Value Binding
 Use DataSource to bind to collection
  and Use DataTextField and
  DataValueField to bind the Value and
  Text of the control in the aspx
 Never forget to call DataBind()
Convert from an HTML to an aspx page
Rich Data Controls
Rich Data Controls Binding
 GridViews, DetailViews,FormView
 Create a link between the data object
  and the data cotrol

   OR

   Finally,
Convert from an HTML to an aspx page
Data Source Controls
 Directly connect to a database, execute
  a query, loop through the records in the
  result set, and display them on a page.
 Designer Support
 No data access code. 
 Includes:
    ◦   SqlDataSource
    ◦   ObjectDataSource
    ◦   AccessDataSource
    ◦   XmlDataSource
    ◦   SiteMapDataSource
Data Source Controls
 Displaying
 Inserting
 Updating
 Deleting
Data Source Binding in the Page
Life Cycle
1.   Page Initialization and Page Load
2.   Control events handling
3.   Data source controls perform
     updates (insert, update, delete)
4.   Page PreRender
5.   Data source controls performs
     queries and fill controls (Selecting
     and Selected Events fired)
6.   Page is rendered then Disposed
Convert from an HTML to an aspx page
N-tier architecture
N-Tier Architecture
ASP.NET Lecture 4
N-Tier Architecture
 Database code MUST NOT be directly in
  the client, but encapsulated in classes.
 Easier maintenance and extension
 Appropriate for all types of applications
  (small/medium/large and desktop/Web)
  applications.
 Implementation:
    ◦ Create the front-end user interface (Windows
      Forms or Web Forms)
    ◦ Create the business rule component class
      library
    ◦ Create a data layer component class library to
N-tier layers
 User Interface
 Business Access Layer (BAL) to wrap
  the business rules and logic (if
  needed)
 Business Object Layer (BOL) to wraps
  each database table or business
  object
 Data Access Layer (DAL) to perform
  database operations
ASP.NET Lecture 4
ASP.NET Lecture 4
ObjectDataSource Controls
 Use ObjectDataSource is used with
  the DAL classes
 Instead of SQLDataSource Controls
    ◦ Maintenance nightmare
    ◦ Lack of flexibility
Convert from an HTML to an aspx page
Reading Assignment #4
 Using Stored Procedures
 Designing layered .NET Applications
http://msdn.microsoft.com/en-
us/library/ms973829.aspx
Lab #4
 Bind Categories in regiter.aspx to
  Categories table through
  SQLdatasource control
 Add a new Customer through the
  registeration Page by using a data
  component
 Create Page to see and edit all
  Customer Data using DetailsView or
  FormView
Bonus
   Add a page to see, edit , insert new
    books and upload images
REFERENCES

 [1] Beginning ASP.NET 4 In C# 2010, Matthew
  Macdonald, Apress
 [2] Web Application Architecture
  Principles, Protocols And Practices, Leon Shklar
  And Richard Rosen, Wiley
 [3] Professional AS P.NE T 4 In C# And VB, Bill
  Evjen, Scott Hanselman And Devin Rader, Wiley
 [4] Pro ASP.NET In C# 2010, Fourth
  Edition,matthew Macdonald, Adam Freeman, And
  Mario Szpuszta, Apress

More Related Content

PPTX
ASP.NET Lecture 2
PPTX
ASP.NET lecture 8
PDF
Data Binding
PPTX
Databind in asp.net
PPTX
Microsoft SQL Server 2008
PPT
Asp.net.
PPT
Data controls ppt
PDF
Asp.net state management
ASP.NET Lecture 2
ASP.NET lecture 8
Data Binding
Databind in asp.net
Microsoft SQL Server 2008
Asp.net.
Data controls ppt
Asp.net state management

What's hot (20)

PDF
Step by Step Asp.Net GridView Tutorials
PPTX
Programming web application
PPTX
Grid Vew Control VB
PPTX
Ch 04 asp.net application
PPT
Database programming in vb net
PPT
ASP.NET 09 - ADO.NET
PPSX
05 asp.net session07
PPT
Database Connection
PPTX
Integrate MongoDB & SQL data with a single REST API
PPSX
06 asp.net session08
PPTX
ATG Architecture
PPTX
Oracle Endeca Developer's Guide
PPT
Chap14 ado.net
PPTX
PPT
1\9.SSIS 2008R2_Training - Introduction to SSIS
PPT
DOCX
Mule with jdbc(my sql)
PPT
Data Access Technologies
Step by Step Asp.Net GridView Tutorials
Programming web application
Grid Vew Control VB
Ch 04 asp.net application
Database programming in vb net
ASP.NET 09 - ADO.NET
05 asp.net session07
Database Connection
Integrate MongoDB & SQL data with a single REST API
06 asp.net session08
ATG Architecture
Oracle Endeca Developer's Guide
Chap14 ado.net
1\9.SSIS 2008R2_Training - Introduction to SSIS
Mule with jdbc(my sql)
Data Access Technologies
Ad

Viewers also liked (9)

PPTX
Ch 7 data binding
PDF
Asp dot net final (2)
PPT
ASPX Session xi(page lifecycle)
PPT
Enterprise application integration
PPT
How Sentiment Analysis works
PDF
Introduction to Sentiment Analysis
PPT
Opinion Mining Tutorial (Sentiment Analysis)
PDF
project sentiment analysis
PDF
TEDx Manchester: AI & The Future of Work
Ch 7 data binding
Asp dot net final (2)
ASPX Session xi(page lifecycle)
Enterprise application integration
How Sentiment Analysis works
Introduction to Sentiment Analysis
Opinion Mining Tutorial (Sentiment Analysis)
project sentiment analysis
TEDx Manchester: AI & The Future of Work
Ad

Similar to ASP.NET Lecture 4 (20)

PPSX
07 asp.net session10
PDF
ASP NET 4 0 in Practice Daniele Bochicchio
PDF
ASP NET 4 0 in Practice Daniele Bochicchio
PDF
ASP NET 4 0 in Practice Daniele Bochicchio
PPTX
Work with data in ASP.NET
PDF
Asp.net
PDF
Beginning ASP NET 4 5 Databases 3rd Edition Sandeep Chanda 2024 scribd download
PPS
07 asp.net session10
PDF
Beginning Aspnet 45 Databases 3rd Edition Sandeep Chanda Damien Foggon
PDF
Asp.net
PPTX
PDF
Mvc acchitecture
PDF
The entity framework 4 and asp net web forms
PDF
Programming ASP NET MVC 4 Developing Real World Web Applications with ASP NET...
PPTX
ASP.NET Lecture 3
PPTX
Hard Coding as a design approach
PPTX
Programming is Fun with ASP.NET MVC
PDF
ASP NET Professional Projects 1st Edition Hersh Bhasin
PDF
ASP NET Professional Projects 1st Edition Hersh Bhasin
PDF
Beginning ASP NET 4 5 Databases 3rd Edition Sandeep Chanda
07 asp.net session10
ASP NET 4 0 in Practice Daniele Bochicchio
ASP NET 4 0 in Practice Daniele Bochicchio
ASP NET 4 0 in Practice Daniele Bochicchio
Work with data in ASP.NET
Asp.net
Beginning ASP NET 4 5 Databases 3rd Edition Sandeep Chanda 2024 scribd download
07 asp.net session10
Beginning Aspnet 45 Databases 3rd Edition Sandeep Chanda Damien Foggon
Asp.net
Mvc acchitecture
The entity framework 4 and asp net web forms
Programming ASP NET MVC 4 Developing Real World Web Applications with ASP NET...
ASP.NET Lecture 3
Hard Coding as a design approach
Programming is Fun with ASP.NET MVC
ASP NET Professional Projects 1st Edition Hersh Bhasin
ASP NET Professional Projects 1st Edition Hersh Bhasin
Beginning ASP NET 4 5 Databases 3rd Edition Sandeep Chanda

More from Julie Iskander (20)

PPTX
PPTX
Data structures and algorithms
PPTX
C for Engineers
PPTX
Design Pattern lecture 3
PPTX
Scriptaculous
PPTX
Prototype Framework
PPTX
Design Pattern lecture 4
PPTX
Design Pattern lecture 2
PPTX
Design Pattern lecture 1
PPTX
Ajax and ASP.NET AJAX
PPTX
PPTX
ASP.NET Lecture 5
PPTX
ASP.NET Lecture 7
PPTX
ASP.NET Lecture 6
PPTX
ASP.NET Lecture 1
PPTX
AJAX and JSON
PPTX
Object Oriented JavaScript
PPTX
DOM and Events
PPTX
Introduction to Client-Side Javascript
PPTX
HTML and CSS part 3
Data structures and algorithms
C for Engineers
Design Pattern lecture 3
Scriptaculous
Prototype Framework
Design Pattern lecture 4
Design Pattern lecture 2
Design Pattern lecture 1
Ajax and ASP.NET AJAX
ASP.NET Lecture 5
ASP.NET Lecture 7
ASP.NET Lecture 6
ASP.NET Lecture 1
AJAX and JSON
Object Oriented JavaScript
DOM and Events
Introduction to Client-Side Javascript
HTML and CSS part 3

ASP.NET Lecture 4

  • 1. ASP.NET 4.0 Julie Iskander MSC. Communication and Electronics
  • 2. Lecture Outlines  Data Binding  Rich Data Controls  n-tier architecture
  • 4. Programatic DataBinding  Using Control Properties ◦ DataSource  a collection (a list, reader, dataset) ◦ DataTextField ◦ DataValueField  Don’t forget to DataBind();
  • 5. Declarative Data Binding  Single-value Binding  Repeated-value Binding
  • 6. Single-Value Binding  <%# expression goes here %>  Expression can be: ◦ A function (must be protected, public) ◦ A property (must be protected, public) ◦ A string literal or an mathematical expression  Bound to TextBox, Label, LinkButton,….etc  Must call Page.DataBind() or Control.DataBind()
  • 7. Repeated-Value Binding  Use DataSource to bind to collection and Use DataTextField and DataValueField to bind the Value and Text of the control in the aspx  Never forget to call DataBind()
  • 8. Convert from an HTML to an aspx page
  • 10. Rich Data Controls Binding  GridViews, DetailViews,FormView  Create a link between the data object and the data cotrol  OR  Finally,
  • 11. Convert from an HTML to an aspx page
  • 12. Data Source Controls  Directly connect to a database, execute a query, loop through the records in the result set, and display them on a page.  Designer Support  No data access code.   Includes: ◦ SqlDataSource ◦ ObjectDataSource ◦ AccessDataSource ◦ XmlDataSource ◦ SiteMapDataSource
  • 13. Data Source Controls  Displaying  Inserting  Updating  Deleting
  • 14. Data Source Binding in the Page Life Cycle 1. Page Initialization and Page Load 2. Control events handling 3. Data source controls perform updates (insert, update, delete) 4. Page PreRender 5. Data source controls performs queries and fill controls (Selecting and Selected Events fired) 6. Page is rendered then Disposed
  • 15. Convert from an HTML to an aspx page
  • 19. N-Tier Architecture  Database code MUST NOT be directly in the client, but encapsulated in classes.  Easier maintenance and extension  Appropriate for all types of applications (small/medium/large and desktop/Web) applications.  Implementation: ◦ Create the front-end user interface (Windows Forms or Web Forms) ◦ Create the business rule component class library ◦ Create a data layer component class library to
  • 20. N-tier layers  User Interface  Business Access Layer (BAL) to wrap the business rules and logic (if needed)  Business Object Layer (BOL) to wraps each database table or business object  Data Access Layer (DAL) to perform database operations
  • 23. ObjectDataSource Controls  Use ObjectDataSource is used with the DAL classes  Instead of SQLDataSource Controls ◦ Maintenance nightmare ◦ Lack of flexibility
  • 24. Convert from an HTML to an aspx page
  • 25. Reading Assignment #4  Using Stored Procedures  Designing layered .NET Applications http://msdn.microsoft.com/en- us/library/ms973829.aspx
  • 26. Lab #4  Bind Categories in regiter.aspx to Categories table through SQLdatasource control  Add a new Customer through the registeration Page by using a data component  Create Page to see and edit all Customer Data using DetailsView or FormView
  • 27. Bonus  Add a page to see, edit , insert new books and upload images
  • 28. REFERENCES  [1] Beginning ASP.NET 4 In C# 2010, Matthew Macdonald, Apress  [2] Web Application Architecture Principles, Protocols And Practices, Leon Shklar And Richard Rosen, Wiley  [3] Professional AS P.NE T 4 In C# And VB, Bill Evjen, Scott Hanselman And Devin Rader, Wiley  [4] Pro ASP.NET In C# 2010, Fourth Edition,matthew Macdonald, Adam Freeman, And Mario Szpuszta, Apress

Editor's Notes

  • #9: DataBindingpageDataSourcePage pageError Bonus
  • #12: RichControlspage
  • #16: DataSourceControlpageEditing, Deleting , InsertingMaster, Detail View.
  • #18: This is not the only available architecture
  • #19: Components of the 2nd and 3rd tier can be put in a class library project (.dll)
  • #25: page