Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint

3.1. Programming Basics

One of the building blocks of an ASP.NET page is the application logic: the actual programming code that allows the page to function. To get anywhere with ASP.NET, you need to grasp the concept of events. Most ASP.NET pages will contain controls such as text boxes, checkboxes, and lists. Each of these controls allow the user to interact with the application in some way: checking checkboxes, scrolling through lists, selecting list items, and so on. Whenever one of these actions is performed, the control will raise an event. It’s by handling these events within our code that we get ASP.NET pages to do what we want.

For example, imagine that a user clicks a button on an ASP.NET page. That button (or, more specifically, the ASP.NET Button control) raises an event (in this case, it will be the Click event). A method called an event handler executes automatically when an event is raised—in this case, the event handler code performs a specific action for that button. For instance, the Click event handler could save form data to a file, or retrieve requested information from a database. Events really are the key to ASP.NET programming, which is why we’ll start this chapter by taking a closer look at them.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial