tailieunhanh - Professional ASP.NET 3.5 in C# and Visual Basic Part 90

Professional in C# and Visual Basic Part 90. Building on the revolutionary release, adds several key new developer features including AJAX, LINQ, and a new CSS designer in Visual Web Developer 2008. The dramatic reduction in code that developers realized from the more than 50 new server controls in now allows developers the time to make their applications more interactive with AJAX, to work with data in their preferred language with LINQ, and to build visually attractive and consistent standards-based sites with CSS. . | Chapter 17 Portal Frameworks and Web Parts InstructionText Literal LineBreak new Literal br LineBreak Statelnput Button InputButton new Button Input State InputButton Literal Spacer new Literal p Spacer StateContents ChildControlsCreated true private void Button1_Click object sender EventArgs e To review you first import the namespace. The important step in the creation of this custom control is to make sure that it inherits from the WebPart class instead of the customary Control class. As stated earlier this gives the control access to the advanced functionality of the Portal Framework that a typical custom control would not have. VB Public Class StateListBox Inherits WebPart End Class C public class StateListBox WebPart After the class structure is in place a few properties are defined and the constructor is defined as well. The constructor directly uses some of the capabilities that the WebPart class provides. These capabilities would not be available if this custom control has the Control class as its base class and is making use of the property. 847 Chapter 17 Portal Frameworks and Web Parts VB Public Sub New False End Sub C public StateListBox AllowClose false This constructor creates a control that explicitly sets the control s AllowClose property to False meaning that the Web Part will not have a Close link associated with it when generated in the page. Because of the use of the WebPart class instead of the Control class you will find in addition to the AllowClose property other WebPart class properties such as AllowEdit AllowHide AllowMinimize Allow-ZoneChange and more. In the example shown in Listing 17-14 you see a custom-defined property .

TỪ KHÓA LIÊN QUAN