Thursday, June 25, 2009

New ASP.Net 2.0 Controls

1. ImageMap: This control extends the Image control with a collection of clickable hot spots. You can create (and configure the dimensions of) as many rectangle, circle, and polygon hotspots as you need. The HotSpotMode property can be used to specify whether the user’s click should cause a postback or navigate the user directly to a URL.

2. BulletedList: When you need to display a bulleted list on your page, this control is a perfect fit. In addition to the databinding capabilities , there are also such useful properties as BulletStyle, which can be set to circles, squares, numbers, roman numerals, custom images, etc. With the DisplayMode property you can specify that the list items be represented by standard text, HyperLinks, or LinkButtons.

3. MultiView: The MultiView control manages multiple View controls to ensure only one is visible at a time. Using the ActiveViewIndex property of the MultiView control we can specify which View should be visible at any particular time. Each View control acts as a content container, and behaves very much like a Panel control at design time.

4. View: Each View control can contain any combination of controls you desire.

5. GridView: A feature-rich replacement for the DataGrid. The DataGrid control was good for its time, but its time is over. It still exists for backward compatibility purposes, but it’s no longer listed in the Visual Studio 2005 toolbox by default. The replacement is the new GridView control, which is better in every way. The paging and sorting functionality is now far more automated, and yet still extensible in case you want to get your hands dirty. The GridView control renders more efficiently than the DataGrid control did, and it supports a wider variety of column types: BoundField, ButtonField, CheckboxField, CommandField, HyperLinkField, ImageField, and TemplateField.

6. DetailsView: The DetailsView control displays the details of a database record on a page. The automated display and editing capabilities provide the potential to eliminate lots of boilerplate code. Like the GridView, it automatically displays appropriate controls when in edit mode and allows for detailed customizations via templates. The DetailsView control can be used by itself, but when combined with the GridView control it provides an elegant solution to many common Master/Detail scenarios.

7. FormView: The FormView control contains seven templates, which can be modified and displayed in varying combinations to support a variety of functionality. The view must be configured via templates at run time or else nothing will appear on the form at run time.

8. LoginView: Displays different sets of controls based on the user’s login status.

9. TreeView: One of the most feature-rich controls of ASP.NET 2.0, but not truly a View control in the same sense as these other View controls.

10. Wizard: This new control takes the MultiView concept to the next level. This rich control lets you create a fully functional wizard to lead users through a sequential set of steps. You can create and configure as many steps as you need in the wizard at design time via the new SmartTag technology of the Visual Studio 2005 designer. The designs you can create are highly customizable because of a flexible object model that permits the use of Templates to represent one or more of the steps. The wizard manages the Back and Next buttons appropriately and persists all control values between each step so you don’t have to worry about such mundane details.

11. Substitution: This new control works in cooperation with the OutputCache directive that’s been around since ASP.NET 1.x. Specifically, it acts as an exception to the OutputCache directive. Set the MethodName property to a valid function name in the page. Every time the page is requested, this function will be called and the return value will be automatically displayed in the Substitution control. This way you can be sure the contents displayed in the control will always be fresh, even though the rest of the page may be pulled from the cache.

12. SqlDataSource: Used for data binding to a Microsoft SQL Server (or SQL Server Express) database.

13. AccessDataSource: Used for data binding to a Microsoft Access database.

14. XMLDataSource: Used for data binding to XML files and streams.

15. ObjectDataSource: Used for data binding to custom middle-tier business objects.

16. SiteMapDataSource: Used for binding to a Site Map, which is stored in XML by default.

17. SiteMapPath: The new SiteMapPath control displays the user’s current location in the navigational hierarchy of the Web site. Each level is represented with a hyperlink so the user can quickly jump to their desired destinations.

18. Menu: This high-quality hierarchical menu control can appear vertically or horizontally. This exceptionally configurable navigation control can be bound to a SiteMapDataSource control or edited independently.

19. Treeview: The ImageSet property lets you automatically display a variety of useful and attractive images in front of each node. While the default behavior is to post back between each node click and raise a SelectedNodeChanged event, the Target property lets you specify another frame in which to display the address in the NavigateURL property, so no postback is required. You can also use the SelectAction property to specify other behaviors, such as expanding the node without a postback, doing nothing, or expanding the node and raising a postback event. Each node can optionally have a checkbox. The TreeView nodes can be configured at design time, bound to a SiteMapDataSource control, or, for larger tree structures, sub nodes can be loaded on demand to conserve server resources. This requires a postback after many of the user’s mouse clicks — except for uplevel browsers, which can take advantage of the automatically generated client-side AJAX code to call back to the server and fill in the nodes without requiring a full-page postback.

20. Login: The new Login control provides a user name and password screen that you may have created dozens of times before. However, you’ll never need to create one ever again, now that it’s been done in such a thoroughly reusable and extensible way.

21. LoginStatus: The new LoginStatus control displays in two different states. If the user is not logged in, it provides a hyperlink to the login page. If the user is logged in, it provides a hyperlink that logs them out. In either case, you can configure the hyperlink text that is displayed.

22.LoginView: The LoginView control is similar to the LoginStatus control, except instead of displaying a simple link, it will display whatever set of controls you’d like based on the user’s login status. It can display one set of controls for logged-out users, and another set of controls for logged-in users. It can also display varying sets of controls based on the current user’s role.

23. ChangePassword: Any decent authentication system must provide users with a way to change their password. The ChangePassword control provides such functionality by providing the standard three-textbox user interface for old password, new password, and verify new password. By default it accepts only strong passwords, and you can configure it to accept whatever combination of letters, numbers, and symbols your requirements demand.

24. PasswordRecovery: Any decent authentication system must also provide a way to deal with forgotten passwords. That’s where the new PasswordRecovery control comes in handy. This flexible control can handle a variety of common techniques for dealing with forgotten passwords, such as secret question/answer pairs, e-mailing a person their password, and/or generating a new password.

25. LoginName: The LoginName control displays the person’s user name when they’re logged in (or when it’s available automatically through Windows Authentication); it’s invisible when the user is not logged in.

26. CreateUserWizard: The CreateUserWizard control is a functionally rich control that allows a user to enter all the standard information a site generally requires to create a new user, such as their desired username, password, e-mail address, etc. It’s fully extensible, allowing you to add whatever custom fields you require. Because it inherits from the Wizard Web control, you can easily divide the user registration process into as many steps as you desire.

27. WebPartManager: The WebPartManager control’s purpose is to manage and orchestrate all the WebPart controls on the page. It is not visible at run time.

28. WebPartZone: Each instance of the WebPartZone control can hold one or more WebParts. Each WebPartZone can be minimized, moved, deleted, or added by the developer and (if configured to do so) by the user. Each user can configure the page to their own liking and the customizations will be remembered and persisted between each of their visits.

29. CatalogZone: The CatalogZone control contains CatalogPart controls, such as DeclarativeCatalogPart, PageCatalogPart, and ImportCatalogPart. These controls are used to create a catalog of WebParts that users can choose to add to their page.

30. EditorPart: EditorPart controls (such as the AppearanceEditorPart, BehaviorEditorPart, LayoutEditorPart, and PropertyGridEditorPart) can only be placed within an EditorZone control. These controls are used to allow users to edit and personalize pages.

31. ConnectionZone: The ConnectionZone control contains ConnectionPart controls. These are used to create connections between WebParts on a page. They permit one WebPart to send information to another WebPart.

32. ProxyWebPartManager: The ProxyWebPartManager control provides a way to specify static connections inside a content page when the WebPageMaster class has been added to a Master Page.

33. Report Viewer: The new Report Viewer control allows you to design reports visually from a DataSet or other data source. It can cache reports, generate reports on demand, retrieve pre-generated reports from SQL Server 2005 Reporting Services, and more.

34. CrystalReportPartsViewer and CrystalReportSource: CrystalReportViewer control from ASP.NET 1.x has been joined by two new companion controls: CrystalReportPartsViewer and CrystalReportSource. Both of these controls are invisible at run time. The CrystalReportSource control manages report data sources, parameters, and caching.

Apart from these new controls many of the older controls have enhancements. For example:

1. Button controls now support posting to other pages and have a declarative client-side OnClientClick event.
2. The Panel control now has scrollbar support so you can easily create scrolling areas within your page.
3. The Validation controls have been enhanced to support multiple independent validation groups within a single page.