Prev | Current Page 734 | Next

Rob Cameron and Dale Michalk

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


570 CHAPTER 11 ?–  DESIGN-TIME SU PPORT
The other item is to ensure that this event is fired in the PerformSelect method override in
the Repeater class:
OnDataBinding(System.EventArgs.Empty);
If this event is not fired in the Repeater class??™s PerformSelect method, the Repeater server
control will not data bind to the design-time data source at runtime. An exception is not thrown.
The Repeater simply renders blank, as if a DataSource was not set. With these items out of the
way, we can now move on to our discussion of the RepeaterDesigner custom designer class.
The RepeaterDesigner class enables our Repeater to ???see??? DataSet objects at design time and
bind to any available DataSet objects, displaying the data at runtime. The RepeaterDesigner also
provides a design-time UI for the Repeater. Listing 11-15 provides the source for
RepeaterDesigner.
Listing 11-15. The RepeaterDesigner Class File
using System;
using System.ComponentModel;
using System.Web.UI.Design;
using System.Web.UI.Design.WebControls;
using ControlsBook2Lib.Ch07;
namespace ControlsBook2Lib.Ch11.Design
{
class RepeaterDesigner : DataBoundControlDesigner
{
TemplateGroupCollection templateGroupCol = null;
public override void Initialize(IComponent component)
{
base.


Pages:
722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746