1 / 19

Chapter 5

Chapter 5. ASP Control Constructs. ASP Statements. Action Statements: Carry out a task Control Statements: Direct the execution of the action statements. Control Statements. Branching Structures Performs a test. Based on the result a set of code will be executed and others skipped.

kato-dyer
Download Presentation

Chapter 5

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 5 ASP Control Constructs

  2. ASP Statements • Action Statements: Carry out a task • Control Statements: Direct the execution of the action statements

  3. Control Statements • Branching Structures • Performs a test. Based on the result a set of code will be executed and others skipped. • Looping Controls • Allows the same blcok of code to be repeated a number of times or as long as a condition exists. • Jumping Controls • Allows the program to pause execution of current code and jump to a different block of code.

  4. Branching Structures • If. . . Then . . . Else • Select . . . Case

  5. Branching Statements • If . . . Then • Common Errors (pp. 146) • Basic Rules (pp. 146) • Select Case • Common Errors (pp. 148-9) • Basic Rules (pp. 150)

  6. Looping Controls • For . . . Next • Do . . . While

  7. Looping Controls • For . . . Next • Common Errors (pp. 155-6) • Basic Rules (pp. 156) • For Each . . . Next • Used for Arrays • Do . . . While • Common Errors (pp. 161) • Basic Rules (pp. 161)

  8. Jumping Controls • Call • Functions • Exit

  9. Jumping Structures • Procedure • Carry out an action like output information on a page. • Function • Carry out an action and return and answer to the code. For example, calculating the days before a payment is due.

  10. Procedure <% Sub Welcome Response.Write "Welcome to my CyberHome." End Sub %> <H1>Doc Rea's Site</H1> <%call Welcome%>

  11. Functions (5 ideas) • Use Function and End Function • The Function receives some information from the main code • Do not have to declare this variable using Dim • Once calculation is complete, it has to report result back to main ASP code. • To call a function simply type the named function followed by parentheses • Send the information from your main body of code to the function. Put whatever to be sent to the function in the parentheses.

  12. Functions • Common Errors (pp. 169)

  13. Chapter 6 Objects, Properties, Methods, and Events

  14. Object • An object can be almost anything in object-oriented programming. • Write programs to make objects interact with one another, change properties (or attributes), etc. • Phone example in book works well.

  15. More Terms • Instance (pp. 177) • Properties (pp. 177-8) • Methods (pp. 178-181) • Parameters • Return Values • Encapsulation

  16. Events • A way for an object to tell the user that something has happened. • Synchronous: first action must be complete before second can occur • Asynchronous: Second action can begin at any time regardless of first

  17. The Telephone Object • Available for download

  18. ASP Object Model • Server object (Chapter 10) • Application object (Chapter 9) • Session object (Chapter 9) • Request object (Chapter 7) • Response object (Chapter 8) • ObjectContext object (not in text)

  19. Valuable Links • Quick listing of properties and methods of the ASP built-in objects from ASP101.com • http://asp101.com/resources/aspobject.asp • Great reference for learning more about the built-in objects • http://help.activeserverpages.com/iishelp/iis/htm/asp/intr1orp.htm • Quick reference card for the built-in objects • http://help.activeserverpages.com/iishelp/iis/htm/asp/iiwaref.htm

More Related