Prev | Current Page 723 | Next

Rob Cameron and Dale Michalk

"Pro ASP.NET 3.5 Server Controls and AJAX Components"

Often,
this text contains instructions on how to work with the control.
GetErrorDesignTimeHtml This method returns a string that contains the HTML to render
if the design-time parser encounters an error when parsing a
control??™s tag
.Initialize This method is invoked when the designer is initialized and applied
to its associated component. This is the place to ensure that the
designer has been associated with the correct control type.
560 CHAPTER 11 ?–  DESIGN-TIME SU PPORT
The Control Designer and Designer Verbs
The TitledThumbnail component is a composite control that has a custom control designer
associated with it via the DesignerAttribute attribute named TitledThumbnailDesigner. This
control designer inherits from ControlDesigner, but with a couple of method overrides to
further customize its functionality.
The first override is Initialize, in which we ensure that TitledThumbnailDesigner is associated
with a TitledThumbnail component:
public override void Initialize(IComponent comp)
{
if (!(comp is TitledThumbnail))
{
throw new
ArgumentException("Must be a TitledThumbnail component.", "component");
}
base.Initialize(comp);
}
The next override is GetDesignTimeHtml, in which we customize behavior to display a
message that the developer/user should set the ImageUrl property as a helpful tip:
public override string GetDesignTimeHtml()
{
ControlCollection cntrls = ((Control)Component).


Pages:
711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735