4.0 Introduction


At the most basic level, forms provide the visual interface of your applications. Each form is a combination of programming logic and user interface rendered as an HTML page by the user's browser. ASP.NET server controls provide the basic building blocks of forms and expose an object model containing properties, methods, and events. Building a basic form in ASP.NET only requires adding some HTML and some server controls to a page and then handling some server control events in the code-behind to modify and interact with the page. These are the basics of forms and are generally well understood even by beginning ASP.NET programmers.

Beyond the basics, though, certain aspects of forms take some getting used to in ASP.NET: in particular, the concept of programming the server and client sides of an application. Forms are inherently client-side because that's where they execute and much of their behavior must be handled in the client browser. This sounds simple enough, but getting forms to do your bidding requires you to write server-side code that writes the client-side code to be executed when the page is loaded in the browser. If that isn't enough, client-side code often needs to be written in JavaScript. Add to that the task of managing the nuances of another scripting language, and you begin to feel as though you're playing 3-D chess.

This chapter provides solutions to many form-related problems you are likely to encounter in using ASP.NET. By the time you've waded through a recipe or two, the required client- and server-side maneuvers ought to be manageable.

Microsoft has made several aspects of working with forms easier in ASP.NET 2.0. For instance, setting a form's default button is a common requirement for many web applications. In ASP.NET 1.x and in classic ASP, setting a form's default button requires you to write custom client-side JavaScript. In ASP.NET 2.0, however, you can use the new DefaultButton property of the form object, as we explain in this chapter's first recipe.



ASP. NET Cookbook
ASP.Net 2.0 Cookbook (Cookbooks (OReilly))
ISBN: 0596100647
EAN: 2147483647
Year: 2003
Pages: 202

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net