TAILIEUCHUNG - Professional ASP.NET 3.5 in C# and Visual Basic Part 130

Professional in C# and Visual Basic Part 130. 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 26 User and Server Controls Bindable true DefaultValue public string Name get return _name set _name value Bindable true DefaultValue public string Text get return _text set _text value public override void DataBind CreateChildControls ChildControlsCreated true protected override void CreateChildControls _message new Message Name Text if null new DefaultMessageTemplate _message _message protected override void RenderContents HtmlTextWriter writer EnsureChildControls ChildControlsCreated true writer To start to dissect this sample first notice the MessageTemplate property. This property allows Visual Studio to understand that the control can contain a template and allows it to display the IntelliSense for that template. The property has been marked with the PersistanceMode attribute indicating that the template control should be persisted as an inner property within the control s tag in the ASPX page. Additionally the property is marked with the TemplateContainer attribute which helps figure out what type of template control this property represents. In this case it s the Message template control you created earlier. 1251 Chapter 26 User and Server Controls The container control exposes two public properties Name and Text. These properties are used to populate the Name and Text properties of the Message control since that class does not allow developers to set the properties directly. Finally the CreateChildControls method called by the DataBind method does most of the heavy lifting in this control. It creates a new Message object passing the values of Name and Text as constructor values. Once the CreateChildControls method completes the base DataBind operation comtinues to execute. This is important because that is where the evaluation of the Name and Text properties occurs which allows you to insert these .

TỪ KHÓA LIÊN QUAN
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.