SlideShare ist ein Scribd-Unternehmen logo
1 von 28
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
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
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

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

Step by Step Asp.Net GridView Tutorials
Step by Step Asp.Net GridView TutorialsStep by Step Asp.Net GridView Tutorials
Step by Step Asp.Net GridView Tutorials
 
Programming web application
Programming web applicationProgramming web application
Programming web application
 
Grid Vew Control VB
Grid Vew Control VBGrid Vew Control VB
Grid Vew Control VB
 
Ch 04 asp.net application
Ch 04 asp.net application Ch 04 asp.net application
Ch 04 asp.net application
 
Database programming in vb net
Database programming in vb netDatabase programming in vb net
Database programming in vb net
 
ASP.NET 09 - ADO.NET
ASP.NET 09 - ADO.NETASP.NET 09 - ADO.NET
ASP.NET 09 - ADO.NET
 
05 asp.net session07
05 asp.net session0705 asp.net session07
05 asp.net session07
 
Database Connection
Database ConnectionDatabase Connection
Database Connection
 
Integrate MongoDB & SQL data with a single REST API
Integrate MongoDB & SQL data with a single REST APIIntegrate MongoDB & SQL data with a single REST API
Integrate MongoDB & SQL data with a single REST API
 
06 asp.net session08
06 asp.net session0806 asp.net session08
06 asp.net session08
 
ATG Architecture
ATG ArchitectureATG Architecture
ATG Architecture
 
Oracle Endeca Developer's Guide
Oracle Endeca Developer's GuideOracle Endeca Developer's Guide
Oracle Endeca Developer's Guide
 
Chap14 ado.net
Chap14 ado.netChap14 ado.net
Chap14 ado.net
 
Database
DatabaseDatabase
Database
 
1\9.SSIS 2008R2_Training - Introduction to SSIS
1\9.SSIS 2008R2_Training - Introduction to SSIS1\9.SSIS 2008R2_Training - Introduction to SSIS
1\9.SSIS 2008R2_Training - Introduction to SSIS
 
Lecture12
Lecture12Lecture12
Lecture12
 
Mule with jdbc(my sql)
Mule with jdbc(my sql)Mule with jdbc(my sql)
Mule with jdbc(my sql)
 
Vb & asp .net
Vb & asp .netVb & asp .net
Vb & asp .net
 
Data Access Technologies
Data Access TechnologiesData Access Technologies
Data Access Technologies
 
Asp.net
Asp.netAsp.net
Asp.net
 

Andere mochten auch

ASPX Session xi(page lifecycle)
ASPX Session xi(page lifecycle)ASPX Session xi(page lifecycle)
ASPX Session xi(page lifecycle)Shrijan Tiwari
 
Enterprise application integration
Enterprise application integrationEnterprise application integration
Enterprise application integrationGoa App
 
How Sentiment Analysis works
How Sentiment Analysis worksHow Sentiment Analysis works
How Sentiment Analysis worksCJ Jenkins
 
Introduction to Sentiment Analysis
Introduction to Sentiment AnalysisIntroduction to Sentiment Analysis
Introduction to Sentiment AnalysisJaganadh Gopinadhan
 
Opinion Mining Tutorial (Sentiment Analysis)
Opinion Mining Tutorial (Sentiment Analysis)Opinion Mining Tutorial (Sentiment Analysis)
Opinion Mining Tutorial (Sentiment Analysis)Kavita Ganesan
 
project sentiment analysis
project sentiment analysisproject sentiment analysis
project sentiment analysissneha penmetsa
 
TEDx Manchester: AI & The Future of Work
TEDx Manchester: AI & The Future of WorkTEDx Manchester: AI & The Future of Work
TEDx Manchester: AI & The Future of WorkVolker Hirsch
 

Andere mochten auch (9)

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

Ähnlich wie ASP.NET Lecture 4

Optimizing Code Reusability for SharePoint using Linq to SharePoint & the MVP...
Optimizing Code Reusability for SharePoint using Linq to SharePoint & the MVP...Optimizing Code Reusability for SharePoint using Linq to SharePoint & the MVP...
Optimizing Code Reusability for SharePoint using Linq to SharePoint & the MVP...Sparkhound Inc.
 
Work with data in ASP.NET
Work with data in ASP.NETWork with data in ASP.NET
Work with data in ASP.NETPeter Gfader
 
Developing Next-Gen Enterprise Web Application
Developing Next-Gen Enterprise Web ApplicationDeveloping Next-Gen Enterprise Web Application
Developing Next-Gen Enterprise Web ApplicationMark Gu
 
What's New for Data?
What's New for Data?What's New for Data?
What's New for Data?ukdpe
 
Adaptive Architecture
Adaptive ArchitectureAdaptive Architecture
Adaptive ArchitectureNick Harrison
 
ADO .NET by Sonu Vishwakarma
ADO .NET by Sonu VishwakarmaADO .NET by Sonu Vishwakarma
ADO .NET by Sonu VishwakarmaSonu Vishwakarma
 
Introduction to SQLite in Adobe AIR
Introduction to SQLite in Adobe AIRIntroduction to SQLite in Adobe AIR
Introduction to SQLite in Adobe AIRPeter Elst
 
06 asp.net session08
06 asp.net session0806 asp.net session08
06 asp.net session08Mani Chaubey
 
Datasource in asp.net
Datasource in asp.netDatasource in asp.net
Datasource in asp.netSireesh K
 
Stucorner dot-net-training-syllabus
Stucorner dot-net-training-syllabusStucorner dot-net-training-syllabus
Stucorner dot-net-training-syllabusSTUCORNER technology
 
C# .NET Developer Portfolio
C# .NET Developer PortfolioC# .NET Developer Portfolio
C# .NET Developer Portfoliocummings49
 

Ähnlich wie ASP.NET Lecture 4 (20)

Optimizing Code Reusability for SharePoint using Linq to SharePoint & the MVP...
Optimizing Code Reusability for SharePoint using Linq to SharePoint & the MVP...Optimizing Code Reusability for SharePoint using Linq to SharePoint & the MVP...
Optimizing Code Reusability for SharePoint using Linq to SharePoint & the MVP...
 
Work with data in ASP.NET
Work with data in ASP.NETWork with data in ASP.NET
Work with data in ASP.NET
 
Developing Next-Gen Enterprise Web Application
Developing Next-Gen Enterprise Web ApplicationDeveloping Next-Gen Enterprise Web Application
Developing Next-Gen Enterprise Web Application
 
What's New for Data?
What's New for Data?What's New for Data?
What's New for Data?
 
CAD Report
CAD ReportCAD Report
CAD Report
 
ASP.NET Lecture 6
ASP.NET Lecture 6ASP.NET Lecture 6
ASP.NET Lecture 6
 
ASP.NET Lecture 3
ASP.NET Lecture 3ASP.NET Lecture 3
ASP.NET Lecture 3
 
Practical OData
Practical ODataPractical OData
Practical OData
 
Adaptive Architecture
Adaptive ArchitectureAdaptive Architecture
Adaptive Architecture
 
ADO .NET by Sonu Vishwakarma
ADO .NET by Sonu VishwakarmaADO .NET by Sonu Vishwakarma
ADO .NET by Sonu Vishwakarma
 
Introduction to SQLite in Adobe AIR
Introduction to SQLite in Adobe AIRIntroduction to SQLite in Adobe AIR
Introduction to SQLite in Adobe AIR
 
Olap
OlapOlap
Olap
 
J2EE pattern 5
J2EE pattern 5J2EE pattern 5
J2EE pattern 5
 
PPT temp.pptx
PPT temp.pptxPPT temp.pptx
PPT temp.pptx
 
ADO.NET by ASP.NET Development Company in india
ADO.NET by ASP.NET  Development Company in indiaADO.NET by ASP.NET  Development Company in india
ADO.NET by ASP.NET Development Company in india
 
B_110500002
B_110500002B_110500002
B_110500002
 
06 asp.net session08
06 asp.net session0806 asp.net session08
06 asp.net session08
 
Datasource in asp.net
Datasource in asp.netDatasource in asp.net
Datasource in asp.net
 
Stucorner dot-net-training-syllabus
Stucorner dot-net-training-syllabusStucorner dot-net-training-syllabus
Stucorner dot-net-training-syllabus
 
C# .NET Developer Portfolio
C# .NET Developer PortfolioC# .NET Developer Portfolio
C# .NET Developer Portfolio
 

Mehr von Julie Iskander

Mehr von Julie Iskander (20)

HTML 5
HTML 5HTML 5
HTML 5
 
Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithms
 
C for Engineers
C for EngineersC for Engineers
C for Engineers
 
Design Pattern lecture 3
Design Pattern lecture 3Design Pattern lecture 3
Design Pattern lecture 3
 
Scriptaculous
ScriptaculousScriptaculous
Scriptaculous
 
Prototype Framework
Prototype FrameworkPrototype Framework
Prototype Framework
 
Design Pattern lecture 4
Design Pattern lecture 4Design Pattern lecture 4
Design Pattern lecture 4
 
Design Pattern lecture 2
Design Pattern lecture 2Design Pattern lecture 2
Design Pattern lecture 2
 
Design Pattern lecture 1
Design Pattern lecture 1Design Pattern lecture 1
Design Pattern lecture 1
 
Ajax and ASP.NET AJAX
Ajax and ASP.NET AJAXAjax and ASP.NET AJAX
Ajax and ASP.NET AJAX
 
jQuery
jQueryjQuery
jQuery
 
ASP.NET Lecture 5
ASP.NET Lecture 5ASP.NET Lecture 5
ASP.NET Lecture 5
 
ASP.NET Lecture 7
ASP.NET Lecture 7ASP.NET Lecture 7
ASP.NET Lecture 7
 
ASP.NET Lecture 1
ASP.NET Lecture 1ASP.NET Lecture 1
ASP.NET Lecture 1
 
AJAX and JSON
AJAX and JSONAJAX and JSON
AJAX and JSON
 
Object Oriented JavaScript
Object Oriented JavaScriptObject Oriented JavaScript
Object Oriented JavaScript
 
DOM and Events
DOM and EventsDOM and Events
DOM and Events
 
Introduction to Client-Side Javascript
Introduction to Client-Side JavascriptIntroduction to Client-Side Javascript
Introduction to Client-Side Javascript
 
HTML and CSS part 3
HTML and CSS part 3HTML and CSS part 3
HTML and CSS part 3
 
HTML and CSS part 2
HTML and CSS part 2HTML and CSS part 2
HTML and CSS part 2
 

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
  • 18.
  • 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
  • 21.
  • 22.
  • 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

Hinweis der Redaktion

  1. DataBindingpageDataSourcePage pageError Bonus
  2. RichControlspage
  3. DataSourceControlpageEditing, Deleting , InsertingMaster, Detail View.
  4. This is not the only available architecture
  5. Components of the 2nd and 3rd tier can be put in a class library project (.dll)
  6. page