TAILIEUCHUNG - Professional ASP.NET 1.0 Special Edition- P35
Professional Special Edition- P35:Those of us who are Microsoft developers can't help but notice that .NET has received a fair amount of visibility over the last year or so. This is quite surprising considering that for most of this period, .NET has been in its early infancy and beta versions. I can't remember any unreleased product that has caused this much interest among developers. And that's really an important point, because ignoring all the hype and press, .NET really is a product for developers, providing a great foundation for building all types of applications | appear in. DefaultValue The default value of the property. Description Text describing the property. This appears at the bottom of the property grid in the Description box. PersistenceMode How or whether changes made to the value of this property should be persisted. Browsable Whether a property is displayed in the designer. TypeConverter Editor Hooks up extended UI for setting the property. The following example shows how we d use the Browsable property to hide the SomeProperty from the properties window Browsable false protected virtual string SomeProperty get . Custom Control Builders A custom control builder is a class that derives from the class ControlBuilder and overrides one or more methods that influence how a server deals with declaration within an page. The following control builder class overrides the AllowWhitespaceLiterals method and returns false to indicate that spaces are not significant. If this method returned true a LiteralControl containing spaces would be created and added to the Controls collection public class NoWhiteSpaceBuilder ControlBuilder public override bool AllowWhitespaceLiterals return false A control builder is associated with a given server control using the ControlBuilder attribute ControlBuilderAttribute typeof NoWhiteSpaceBuilder Designer public class SomeControl Control . User Controls Although we have not explicitly discussed creating user controls in this chapter see Chapter 4 all of the features we have shown can be pretty much applied to them as is. One of the key benefits of using user controls is that complex sections of the UI can be declared using nothing but control declarations. In a server control you d have to write code to achieve this. Although not difficult this can be time consuming - changing or maintaining it can take longer - and also it s more error prone. Why Create Your Own Server Controls Why Create Your Own Controls isn t .
đang nạp các trang xem trước