ASP.NET 4.0
Julie Iskander
MSC. Communication and Electronics
Lecture Outlines
   WebSite Design
    ◦ Master Page
    ◦ Themes and Skins
    ◦ Website Navigation
   ADO.NET Fundamentals
    ◦ Connected Model
    ◦ Disconnected Models
Website Design
“A Consistent Look and
Feel”
Master Page (.master)
 A templates that renders common
  appearance to all pages attached to it
 Rich design time support
 To work with them, we will create two
  types of pages
     MasterPages: a page template, contains
      controls and content placeholders
     ContentPages: references a single master
      page, to acquire layout, add page specific
      content in the content placeholders
.aspx                             .master

   In page                          All common HTML
    directive, MasterPageFile         tags, <html>,<head>,<bo
    = “masterpage url”                dy>
   Contain Content Control          All common controls
    that is linked to a certain      Contain
    ContentPlaceHolder in             ContentPlaceholder
    the master page                   Control  where the
   New content can be                page content will appear
    added only in the content
    control


         Master Page (.master)
ASP.NET Lecture 3
Content Page
Convert from an HTML to an aspx page
Themes and skins
   What is the problem?
    ◦ To make control properties consistent, not just
      style properties
    ◦ To style complex controls like Calendar and
      Grids
   Themes:
    ◦   Are control-based, not HTML-based
    ◦   Are applied on the server
    ◦   Don’t cascade as in CSS
    ◦   Set in web.config or in each individual page
   Skins:
    ◦ Are text files with .skin extension
    ◦ Contains a list of control tags and set properties
      that need to be standardized
Themes and Skins
Convert from an HTML to an aspx page
Themes in Page Directive
Themes in web.config
Named Skins and SkinID




 What happens if all skins
 have IDs?
Themes and Skins
   Applying Themes dynamically:
    ◦ Page.Theme
    ◦ Page.StyleSheet
   This must be done in the PreInit event.
  Why????????????
 How to make a user
  change themes in his
  page?
ADO.NET
Fundamentals
ADO.NET
 Contains managed classes to connect to
  data sources (Relational DB), execute
  commands, manage disconnected data.
 It includes:
    ◦ Connection: establish connection to a
      DataSource.
    ◦ Command: execute SQL commands and stored
      procedures.
    ◦ DataReader: fast read-only, forward-only
      access.
    ◦ DataAdapter: fill DataSet from a DataSource, to
      apply changes to a DataSource, according to the
Connection class (implement
IDBConnection)
 A limited-server resource must be
  opened as late as possible and
  release it as quickly as possible.
 Connection String Stored in
  web.config
Connection class (implements
IDBConnection)
 To retrieve connection string
 Using System.Web.Configuration
Command Class (Implements
IDbCommand)
    Command class  to execute any
    type of SQL statement.
Command Methods
DataReader Class
 To read the data returned by a
  SELECT command one record at a
  time, in a forward-only, read-only
  stream.
 Provides the quickest possible access
  to data.
ASP.NET Lecture 3
SQL Injection
SQL Injection Attacks
 The process of passing SQL code into
  an application, in a way that was not
  intended or anticipated by the
  application developer.
 Affects only applications that use SQL
  string building techniques to create a
  command with user-supplied values.
 Solution  use parameterized
  command or a stored procedure
Parameterized Commands
   A command that uses placeholders in
    the SQL text.
Convert from an HTML to an aspx page
Disconnected Model
   Using DataAdapters and DataSets
ASP.NET Lecture 3
Disconnected Model
   Using DataSets you can:
    ◦ Work on multiple tables and relations
    ◦ Get ChildRows using the relations
    ◦ Search Tables by criteria using Select
      Method
   More in Pro ASP.NET 4 pages 340 -
    344
Convert from an HTML to an aspx page
Navigation Controls
(Self study in lab)
Site Map
   Add a web.sitemap
    ◦ XML file describing the site
ASP.NET Lecture 3
Control Binding to a sitemap
   Controls to map to:
    ◦ SiteMap Path



    ◦ Menu
Reading Assignment #3
   Applying Themes Dynamically
Report #3
 How to dynamically set a MasterPage
  and in which state of the Page life
  cycle?
 What is a TreeView Control?
Lab #3
 Create masterpage.master for the
  site, with the date user control.
 Create three skins
  Default(green), Pink and Blue
  (StyleSheet, image and skin for image
  button)
 Add a sitemap to masterpage
 Add Home.aspx and Login.aspx
 Modify the three
  pages(register, books, checkout) to be
  able to use the master page
Lab #3
   In register.aspx
    ◦ Get the country and city from the
      database
   Bonus:
    ◦ Create modifyCities.aspx, using
      disconnected model insert, edit and
      delete cities.
Lab Hints
   Control ID problem with masterpage
    and css???
    ◦ Try ClientIDMode=static for page
Bonus
   Add a usercontrol to change
    themes, with the radiobuttons. Add it
    to the masterpage. How will it be
    applied to all pages????
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
Media queries A to Z
PDF
Flexbox and Grid Layout
PPTX
Bootstrap 5 whats new
PPTX
Html n CSS
PPT
Introduction to CSS
PPTX
PPTX
Flexbox
Media queries A to Z
Flexbox and Grid Layout
Bootstrap 5 whats new
Html n CSS
Introduction to CSS
Flexbox

What's hot (20)

PDF
Introduction to Javascript
PPTX
Native, Hybrid, or Cross-platform Development? What Type of Mobile App is Bes...
PPTX
PPTX
Bootstrap 3
PPTX
Html5 Basics
PPTX
Bootstrap 5 ppt
PDF
Website Layout and Structure
PPTX
HYPERLINKING IN WORD AND HYPERLINKING IN PRESENTATION
PPTX
PPTX
Css animation
PDF
Docker Best Practices Workshop
PDF
Intro to react native
PDF
CSS framework By Palash
PPTX
HTML and Responsive Design
PPTX
Top frontend web development tools
PPT
cascading style sheet ppt
PDF
Introduction to Bootstrap
PDF
CSS3 Media Queries
PPS
Web Site Design Principles
Introduction to Javascript
Native, Hybrid, or Cross-platform Development? What Type of Mobile App is Bes...
Bootstrap 3
Html5 Basics
Bootstrap 5 ppt
Website Layout and Structure
HYPERLINKING IN WORD AND HYPERLINKING IN PRESENTATION
Css animation
Docker Best Practices Workshop
Intro to react native
CSS framework By Palash
HTML and Responsive Design
Top frontend web development tools
cascading style sheet ppt
Introduction to Bootstrap
CSS3 Media Queries
Web Site Design Principles
Ad

Viewers also liked (20)

PPTX
Master pages ppt
PPT
Master pages
PPT
Asp.net.
PPTX
Databind in asp.net
PPTX
Master Pages In Asp.net
PPTX
State management
PPS
Asp.Net 2.0 Presentation
PPT
JSP Custom Tags
PPT
Simple Data Binding
PPT
PPTX
Windows Presentation Foundation
PPTX
Ch 7 data binding
PPTX
State management
PPTX
ASP.NET State management
PPT
State management in ASP.NET
PDF
Web Navigation Presentation
DOC
WCF tutorial
PPT
JSP Standart Tag Lİbrary - JSTL
PDF
JSP Standard Tag Library
Master pages ppt
Master pages
Asp.net.
Databind in asp.net
Master Pages In Asp.net
State management
Asp.Net 2.0 Presentation
JSP Custom Tags
Simple Data Binding
Windows Presentation Foundation
Ch 7 data binding
State management
ASP.NET State management
State management in ASP.NET
Web Navigation Presentation
WCF tutorial
JSP Standart Tag Lİbrary - JSTL
JSP Standard Tag Library
Ad

Similar to ASP.NET Lecture 3 (20)

PPT
ASP.NET 06 - Customizing Your Sites Appearance
PDF
Chapter 1 (asp.net over view)
PPTX
ASP.NET Lecture 1
PPT
Master pages
DOCX
To create a web service
PPTX
Overview of ASP.Net by software outsourcing company india
PDF
Master Pages And Navigation
PPTX
ASP.NET Lecture 6
DOCX
Master page
PPTX
masterpages 1.pptx
PDF
Asp.net w3schools
PPT
asp .net training | asp.net course | asp.net training online | learn asp.net
PPTX
Lecture slides_Introduction to ASP.NET presentation
PPTX
Master page in Asp.net
PDF
Asp.netrole
PDF
Introducing asp.net web pages 2
PPS
14 asp.net session20
PPTX
ASP.NET Lecture 2
PPTX
Developing branding solutions
ASP.NET 06 - Customizing Your Sites Appearance
Chapter 1 (asp.net over view)
ASP.NET Lecture 1
Master pages
To create a web service
Overview of ASP.Net by software outsourcing company india
Master Pages And Navigation
ASP.NET Lecture 6
Master page
masterpages 1.pptx
Asp.net w3schools
asp .net training | asp.net course | asp.net training online | learn asp.net
Lecture slides_Introduction to ASP.NET presentation
Master page in Asp.net
Asp.netrole
Introducing asp.net web pages 2
14 asp.net session20
ASP.NET Lecture 2
Developing branding solutions

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 8
PPTX
ASP.NET Lecture 7
PPTX
ASP.NET Lecture 4
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 8
ASP.NET Lecture 7
ASP.NET Lecture 4
AJAX and JSON
Object Oriented JavaScript
DOM and Events
Introduction to Client-Side Javascript
HTML and CSS part 3

Recently uploaded (20)

PDF
CCUS-as-the-Missing-Link-to-Net-Zero_AksCurious.pdf
PDF
zbrain.ai-Scope Key Metrics Configuration and Best Practices.pdf
PDF
CXOs-Are-you-still-doing-manual-DevOps-in-the-age-of-AI.pdf
PDF
Advancing precision in air quality forecasting through machine learning integ...
PPTX
Rise of the Digital Control Grid Zeee Media and Hope and Tivon FTWProject.com
PDF
Transform-Your-Factory-with-AI-Driven-Quality-Engineering.pdf
PDF
A hybrid framework for wild animal classification using fine-tuned DenseNet12...
PPTX
Build automations faster and more reliably with UiPath ScreenPlay
PPTX
How to use fields_get method in Odoo 18
PPTX
Information-Technology-in-Human-Society.pptx
PPTX
Blending method and technology for hydrogen.pptx
PDF
Transform-Your-Streaming-Platform-with-AI-Driven-Quality-Engineering.pdf
PDF
NewMind AI Journal Monthly Chronicles - August 2025
PDF
5-Ways-AI-is-Revolutionizing-Telecom-Quality-Engineering.pdf
PPTX
How to Convert Tickets Into Sales Opportunity in Odoo 18
PPTX
Report in SIP_Distance_Learning_Technology_Impact.pptx
PDF
Lung cancer patients survival prediction using outlier detection and optimize...
PDF
Identification of potential depression in social media posts
PDF
Decision Optimization - From Theory to Practice
PDF
SaaS reusability assessment using machine learning techniques
CCUS-as-the-Missing-Link-to-Net-Zero_AksCurious.pdf
zbrain.ai-Scope Key Metrics Configuration and Best Practices.pdf
CXOs-Are-you-still-doing-manual-DevOps-in-the-age-of-AI.pdf
Advancing precision in air quality forecasting through machine learning integ...
Rise of the Digital Control Grid Zeee Media and Hope and Tivon FTWProject.com
Transform-Your-Factory-with-AI-Driven-Quality-Engineering.pdf
A hybrid framework for wild animal classification using fine-tuned DenseNet12...
Build automations faster and more reliably with UiPath ScreenPlay
How to use fields_get method in Odoo 18
Information-Technology-in-Human-Society.pptx
Blending method and technology for hydrogen.pptx
Transform-Your-Streaming-Platform-with-AI-Driven-Quality-Engineering.pdf
NewMind AI Journal Monthly Chronicles - August 2025
5-Ways-AI-is-Revolutionizing-Telecom-Quality-Engineering.pdf
How to Convert Tickets Into Sales Opportunity in Odoo 18
Report in SIP_Distance_Learning_Technology_Impact.pptx
Lung cancer patients survival prediction using outlier detection and optimize...
Identification of potential depression in social media posts
Decision Optimization - From Theory to Practice
SaaS reusability assessment using machine learning techniques

ASP.NET Lecture 3

  • 1. ASP.NET 4.0 Julie Iskander MSC. Communication and Electronics
  • 2. Lecture Outlines  WebSite Design ◦ Master Page ◦ Themes and Skins ◦ Website Navigation  ADO.NET Fundamentals ◦ Connected Model ◦ Disconnected Models
  • 4. Master Page (.master)  A templates that renders common appearance to all pages attached to it  Rich design time support  To work with them, we will create two types of pages  MasterPages: a page template, contains controls and content placeholders  ContentPages: references a single master page, to acquire layout, add page specific content in the content placeholders
  • 5. .aspx .master  In page  All common HTML directive, MasterPageFile tags, <html>,<head>,<bo = “masterpage url” dy>  Contain Content Control  All common controls that is linked to a certain  Contain ContentPlaceHolder in ContentPlaceholder the master page Control  where the  New content can be page content will appear added only in the content control Master Page (.master)
  • 8. Convert from an HTML to an aspx page
  • 9. Themes and skins  What is the problem? ◦ To make control properties consistent, not just style properties ◦ To style complex controls like Calendar and Grids  Themes: ◦ Are control-based, not HTML-based ◦ Are applied on the server ◦ Don’t cascade as in CSS ◦ Set in web.config or in each individual page  Skins: ◦ Are text files with .skin extension ◦ Contains a list of control tags and set properties that need to be standardized
  • 11. Convert from an HTML to an aspx page
  • 12. Themes in Page Directive
  • 14. Named Skins and SkinID What happens if all skins have IDs?
  • 15. Themes and Skins  Applying Themes dynamically: ◦ Page.Theme ◦ Page.StyleSheet  This must be done in the PreInit event. Why????????????  How to make a user change themes in his page?
  • 17. ADO.NET  Contains managed classes to connect to data sources (Relational DB), execute commands, manage disconnected data.  It includes: ◦ Connection: establish connection to a DataSource. ◦ Command: execute SQL commands and stored procedures. ◦ DataReader: fast read-only, forward-only access. ◦ DataAdapter: fill DataSet from a DataSource, to apply changes to a DataSource, according to the
  • 18. Connection class (implement IDBConnection)  A limited-server resource must be opened as late as possible and release it as quickly as possible.  Connection String Stored in web.config
  • 19. Connection class (implements IDBConnection)  To retrieve connection string  Using System.Web.Configuration
  • 20. Command Class (Implements IDbCommand)  Command class  to execute any type of SQL statement.
  • 22. DataReader Class  To read the data returned by a SELECT command one record at a time, in a forward-only, read-only stream.  Provides the quickest possible access to data.
  • 25. SQL Injection Attacks  The process of passing SQL code into an application, in a way that was not intended or anticipated by the application developer.  Affects only applications that use SQL string building techniques to create a command with user-supplied values.  Solution  use parameterized command or a stored procedure
  • 26. Parameterized Commands  A command that uses placeholders in the SQL text.
  • 27. Convert from an HTML to an aspx page
  • 28. Disconnected Model  Using DataAdapters and DataSets
  • 30. Disconnected Model  Using DataSets you can: ◦ Work on multiple tables and relations ◦ Get ChildRows using the relations ◦ Search Tables by criteria using Select Method  More in Pro ASP.NET 4 pages 340 - 344
  • 31. Convert from an HTML to an aspx page
  • 33. Site Map  Add a web.sitemap ◦ XML file describing the site
  • 35. Control Binding to a sitemap  Controls to map to: ◦ SiteMap Path ◦ Menu
  • 36. Reading Assignment #3  Applying Themes Dynamically
  • 37. Report #3  How to dynamically set a MasterPage and in which state of the Page life cycle?  What is a TreeView Control?
  • 38. Lab #3  Create masterpage.master for the site, with the date user control.  Create three skins Default(green), Pink and Blue (StyleSheet, image and skin for image button)  Add a sitemap to masterpage  Add Home.aspx and Login.aspx  Modify the three pages(register, books, checkout) to be able to use the master page
  • 39. Lab #3  In register.aspx ◦ Get the country and city from the database  Bonus: ◦ Create modifyCities.aspx, using disconnected model insert, edit and delete cities.
  • 40. Lab Hints  Control ID problem with masterpage and css??? ◦ Try ClientIDMode=static for page
  • 41. Bonus  Add a usercontrol to change themes, with the radiobuttons. Add it to the masterpage. How will it be applied to all pages????
  • 42. 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

  • #4: One way is by creating a template page that inherits System.Web.UI.Page, and use it as a parent to all other pagesVS Design doen’t support that
  • #6: When a page with masterpage is requested, the master page must be rendered and merged with the page contents to create a single final, page to be rendered to the response
  • #7: Master Directive
  • #9: MasterPage.masterDefault.aspxTry writing outside of content holder see errorSee designer
  • #10: If a property is specified in a theme and in the individual control, the theme overrides all other
  • #11: Theme a folder contains css and skins
  • #12: Try creating theme folder and add stylesTry creating skins for a calendar controlNo skin designer support, copy and past controls from pages after setting itTry cascading effect (theme vs. styesheettheme)
  • #15: Only controls with the skinID will apply the skin
  • #16: After PreInitthrow an exception because after preinit controls are createdTheme changes aren’t read until page reload and passed PreInitstageuseServer.Transfer to refresh to itself.
  • #18: Standardized ADO.NET through depending on a number of interfaces and base classes.
  • #20: Connection.Close equivalent to connection.Dispose()
  • #28: ADO.Net page
  • #32: ADO.Net page