Chapter 6 Using Web Forms ASP.NETWhy ASP.NET?Windows or Web Forms?Client/Server Web ApplicationsBrowser SupportWeb PagesASP.NETVisual Basic and ASP.NETFile Types in a Web ProjectSlide 10The ASP.NET Application FileSlide 12Cascading Style SheetsUsing StylesThe Default CSS FileModifying StylesApplying the StylesWeb Configuration FileSlide 19Slide 20DLL FilesCreating a Web Forms ProjectWeb Forms in the Visual Studio IDESlide 24Naming a Web FormWeb Controls / Maintaining State / ValidationControlsWeb Server ControlsEvent HandlingButton ControlsThe Hyperlink ControlSetting the Navigate Url Property at Design TimeChoosing the Right Navigation ControlThe Calendar ControlSlide 35The Background ImageSetting the Tab OrderSetting Initial FocusIIS ObjectsLinking to Another PageThe Validator ControlSlide 42Displaying AsterisksSlide 44Testing for ValidityA Response ObjectA Request ObjectA Response Object ExampleState ManagementSlide 50Overview of State Management Techniques – Server SideOverview of State Management Techniques – Client SideApplication and Session ObjectsSession ObjectsSlide 55Cookieless SessionsCookiesThe ViewState PropertyLocation of FilesChapter 6 Chapter 6 Using Web Using Web Forms Forms ASP.NETASP.NETAdvanced Programming Using Advanced Programming Using Visual Basic.NETVisual Basic.NET © 2003 by The McGraw-Hill Companies, Inc. All rights reserved.22Why ASP.NET?Why ASP.NET?Full power of the .NET language suiteFull power of the .NET language suite.dll’s multithreaded.dll’s multithreaded.NET class libraries available.NET class libraries availableIncreased speed an powerIncreased speed an powerSupports all the functionality of Supports all the functionality of classical ASP +classical ASP +33Windows or Web Forms?Windows or Web Forms?Windows Form applications run on Windows Form applications run on systems with Windows operating systems with Windows operating systemssystemsWeb Forms are the gateway to cross-Web Forms are the gateway to cross-platform developmentplatform development–Support for distributed applicationsSupport for distributed applications–Display in a browser applicationDisplay in a browser application–Connect via an Internet Service Provider Connect via an Internet Service Provider (ISP)(ISP)44Client/Server Web Client/Server Web ApplicationsApplicationsThe Web server sends Web pages to The Web server sends Web pages to the clientthe client–Make the development machine a Make the development machine a server with Internet Information server with Internet Information Services (IIS).Services (IIS).–IIS handles the Web server functionsIIS handles the Web server functionsWeb ClientsWeb Clients–The browser acts as the clientThe browser acts as the client–Pages are written in HTML and scriptPages are written in HTML and script55Browser SupportBrowser SupportASP.NET applications run best in ASP.NET applications run best in Internet ExplorerInternet ExplorerUplevel browsersUplevel browsers – IE 5.5 and above – IE 5.5 and aboveDownlevel browsersDownlevel browsers – IE 5.05 and – IE 5.05 and below and all other browsersbelow and all other browsersASP.NET is aware of the browser ASP.NET is aware of the browser running the application running the application –HTML is customized ie. CSSHTML is customized ie. CSS66Web PagesWeb PagesHTML Web pages are statelessHTML Web pages are stateless–A page does not store any information about its A page does not store any information about its contents from one invocation to the nextcontents from one invocation to the nextTo send state information to the server as To send state information to the server as part of the URL, store “cookies” on the part of the URL, store “cookies” on the local machinelocal machineServers dynamically generate HTML to Servers dynamically generate HTML to render a pagerender a page–Using DHTML (dynamic HTML)Using DHTML (dynamic HTML)–Using ASP (active server pages)Using ASP (active server pages)77ASP.NETASP.NETWeb development tool that replaces ASPWeb development tool that replaces ASP–Libraries, controls, and programming supportLibraries, controls, and programming supportWhen you use Web forms in Visual When you use Web forms in Visual Basic.NET, you’re using ASP.NETBasic.NET, you’re using ASP.NETUse VB and ASP.NET to create OOED Use VB and ASP.NET to create OOED programs with multiple classes that use programs with multiple classes that use inheritanceinheritanceWeb ApplicationsWeb Applications88Visual Basic and ASP.NETVisual Basic and ASP.NETEach Web form has 2 distinct partsEach Web form has 2 distinct parts1.1.HTML and instructions to render the HTML and instructions to render the pagepage–Generates a file with Generates a file with .aspx.aspx extension extension–HTML is generated automatically by the IDEHTML is generated automatically by the IDE2.2.Visual Basic codeVisual Basic codeGenerates a file with an Generates a file with an .aspx.vb.aspx.vb extension extensionProgram logic to respond to event – the Program logic to respond to event – the “CodeBehind” module“CodeBehind” moduleWeb ApplicationsWeb Applications99File Types in a Web ProjectFile Types in a Web ProjectTwo files make up the Two files make up the form - .aspx and form - .aspx and aspx.vbaspx.vb.aspx file holds the .aspx file holds the specifications for the specifications for the user interface used by user interface used by the server to render the server to render the page the page (FormName.aspx)(FormName.aspx).aspx.vb file holds the .aspx.vb file holds the VB source code VB source code (FormName.aspx.vb)(FormName.aspx.vb)Files in Web ProjectsFiles in Web Projects1010File File Type PurposeFormName.aspx ASP.NET Dynamically generates a Web user interface allowing for server-side code.FormName.aspx.vb Visual Basic Code Supplies the code procedures for the form. The "code-behind" the aspx file.AssemblyInfo.vb Project information Holds information about the project such as assembly names and versions.ProjectName.vsdisco XML discovery file. Holds links (URLs) to help locate the necessary Web services.Global.asax ASP.NET application file Supplies any code needed to respond to Application- and Session-level events.Styles.css Cascading Style Sheet Formats and positions Web page elements.Web.config Configuration Contains configuration information about each URL resource used in the project.1111The
View Full Document