Chapter 10. Working with ASP.NET Controls

IN THIS CHAPTER

Using standard controls

Implementing validation by using ASP.NET controls

Implementing navigation in ASP.NET Web sites

Working with login controls

Enhancing forms with ASP.NET controls

Exploring ASP.NET Web part controls

ASP.NET 2.0 introduces a large number of server controls that can easily be used to implement most of the common Web site functions. The term server controls means that these controls hold ASP.NET code, which is actually processed on a Web server, and the resultant HTML code generated is then sent to a Web browser for display. Using these controls, Web designers can implement complicated scenarios on Web sites without having to manually write much code. Most of these controls can be worked with declaratively, which means you don't have to write a large amount of code to make use of these controls, and the purpose can be availed by setting properties or attributes for the controls in HTML at design time. This makes working with these controls very easy and significantly reduces the development time and overhead. ASP.NET 2.0 provides Web controls for many commonly needed Web site operations, such as data access, login screens, validation, navigation and menus, treeviews, etc.

SharePoint Designer provides the ability to make use of most of the ASP.NET 2.0 controls. Using a design interface similar to Visual Studio, Web designers can insert controls on ASP.NET Web pages and then exploit them by using control properties and attributes. SharePoint Designer allows you to work with the following set of control categories:

  • Standard Controls: These are generic controls (including dropdown menus, list boxes, text fields, and buttons) that aid in designing Web site features, such as forms, views, wizards, etc.

  • Data Controls: These are Web controls that allow you to declaratively develop applications for data access from a wide range of data sources, such as SQL Server, XML files, Access databases, etc.

  • Validation Controls: This set of controls provides built-in validation capability for user input. These controls can be bound to other Web controls to constrain and verify user input, thereby providing security and protection to the back end that interfaces with the Web controls.

  • Navigation Controls: These provide out-of-the-box functionality for developing site navigation, dropdown menus, and treeviews.

  • Login Controls: These allow you to develop login screens for Web sites and helps implement an interface for custom authentication and secure access.

NOTE

For more on ASP.NET 2.0 data controls, see Chapter 16.

This chapter discusses using the SharePoint Designer designing interface to develop Web pages by using the ASP.NET 2.0 Web controls. You work with many of the ASP.NET 2.0 controls in the various exercises throughout this chapter and gain understanding about the properties, attributes, and usage of these Web controls.

ASP.NET pages need to be published to a Web server to run. The Web server is responsible for processing the code that ASP.NET pages carry. If you browse to an ASP.NET Web page directly from the file system path (for example, C:websitelocation), you would see the actual code of a Web page in a browser. When you press F12 in SharePoint Designer to preview a Web page, SharePoint Designer invokes the ASP.NET Development Server for executing the Web page. The ASP.NET Development Server, which is installed when you install SharePoint Designer, is a lightweight Web server that assists designers who don't have a Web server machine to quickly preview the ASP.NET Web pages in a browser. As shown in Figure 10.1, when you work on a local Web site (residing on a file system location) and then preview an ASP.NET Web page in a browser by pressing F12 in SharePoint Designer, SharePoint Designer instantiates the ASP.NET Development Server.

Figure 10.1. The ASP.NET Development Server is invoked when previewing a disk-based ASP.NET Web page.

The local ASP.NET page is executed and rendered by the ASP.NET Development Server and then displayed in a browser. The ASP.NET Development Server isn't invoked when previewing the ASP.NET Web pages inside a server-based Web site. In that case, the Web page is requested from its Web server location itself.

If you click the ASP.NET Development Server button in the notification area of the taskbar, the ASP.NET Development Server dialog box opens, as shown in Figure 10.2.

Figure 10.2. The ASP.NET Development Server dialog box

This dialog box displays the physical file system location of the Web site being rendered by using the ASP.NET Development Server. It also provides you with a Stop button that you can click to stop the ASP.NET Development Server. As shown in Figure 10.3, the Preview tab in the Site Settings dialog box (accessible by choosing Site Site Settings) allows you to specify whether you want to use the ASP.NET Development Server for previewing ASP.NET Web pages.

Figure 10.3. The Preview tab in the Site Settings dialog box

You can choose to use the ASP.NET Development Server for previewing only ASP.NET pages or all Web pages inside a Web site. The option to use the ASP.NET Development Server is grayed out when working on server-based Webs. SharePoint Designer indicates that you can only use the ASP.NET Development Server for disk-based Webs.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.10.49