Thursday, 2 February 2012

ASP.NET Server Controls | ASP.Net Tutorial | ASP.Net Tutorial PDF

    At the heart of any ASP.NET page lie server controls, which represent dynamic elements with which your users can interact. There are three basic types of server control: ASP.NET controls, HTML controls, and web user controls.
    Usually, an ASP.NET control must reside within a <form runat="server"> tag in order to function correctly. Controls offer the following advantages to ASP.NET developers:
  • They give us the ability to access HTML elements easily from within our code: we can change these elements’ characteristics, check their values, or even update them dynamically from our server-side programming language of choice.
  • ASP.NET controls retain their properties thanks to a mechanism called view state. We’ll be covering view state later in this chapter. For now, you need to know that view state prevents users from losing the data they’ve entered into a form once that form has been sent to the server for processing. When the response comes back to the client, text box entries, drop-down list selections, and so on are all retained through view state.
  • With ASP.NET controls, developers are able to separate a page’s presentational elements (everything the user sees) from its application logic (the dynamic portions of the ASP.NET page), so that each can be maintained separately.
  • Many ASP.NET controls can be “bound” to the data sources from which they will extract data for display with minimal (if any) coding effort.
ASP.NET is all about controls, so we’ll be discussing them in greater detail as we move through this book. In particular, Chapter 4 explains many of the controls that ship with ASP.NET. For now, though, let’s continue our dissection of an ASP.NET page.