-
Mastering Web Site Fundamentals - The Page
The difference between a web page that simply displays information and a web application that interacts with your user is the application’s ability to gather data from the user, process it on the server, and take action accordingly. The core of a web application is the page and its interactive controls. This part of the chapter will introduce the web page and the types of controls that you’ll use throughout the remainder and throughout your ASP.NET programming career. We will also introduce the mindset that will move your applications from being a “brochure” that displays information into an interactive application delivered over the Web.
Every ASP.NET web site consists of at least one web page stored in a single file with the extension .aspx. There is usually more than one file. The .aspx file is called a content file. Some developers call it the markup file, which makes sense when you remember that HTML stands for HyperText Markup Language. The contents of the page itself are composed of “server controls” and “normal” HTML. Server controls are simply controls with code that runs on the server. Normal HTML in the .aspx file is sent to the browser “as is.” All you really need to know to create ASP.NET pages is that HTML is rendered at the browser, and the controls are processed on the server. If you want to know the technical details, you can see the sidebar “How Pages Are Processed on the Server,” but that requires some background in object-oriented programming that we won’t go into here in detail. The .aspx files can also contain script blocks, usually written in JavaScript, to be executed on the client. Server-side code is executed on the server; client-side script is executed on the client’s machine by the browser.
The normal structure for an ASP.NET with AJAX application is this: the markup (content) file contains controls. Some of the controls will be server controls. You already saw a server control in the HelloWorld example—Button1. The event handler code you wrote for Button1 was stored in a second file called the code-behind file, and executed on the server. The server controls also contain other code that enables their basic functions, but you usually won’t be able to access that. Other controls are AJAX controls, and their code is sometimes written in script blocks in the markup file, or more commonly, it is buried in .dll files provided to you by Microsoft (and thus not visible to you as script code), but which is interpreted by the browser on the client machine, so you don’t need to worry about how it’s done. There are also HTML controls that are passed “as is” to the client machine’s browser, such as tables, and
(the line break tag), and so on.
If a markup file is named Welcome.aspx, its associated code-behind file will be named Welcome.aspx.vb, indicating that the code-behind file is written in Visual Basic (.vb) (or Welcome.aspx.cs if you are writing in C#).
ASP.NET also allows you to create so-called HTML-server controls, which are HTML controls with the tag runat="server", but these are not commonly used.
Source of Information : OReilly Learning ASP .NET 3.5
Subscribe to:
Post Comments (Atom)
0 comments: