/// <include file='doc\AdRotator.uex' path='docs/doc[@for="AdRotator.AdRotator"]/*' />
        public AdRotator() : base()
        {
            _webAdRotator = CreateWebAdRotator();

            _image.EnableViewState = false;

            this.Controls.Add(_webAdRotator);
            this.Controls.Add(_image);

            // The default value of the Target property of the web AdRotator is
            // set to "_top".  Since we are not exposing this property, we need
            // to explicity set it to empty string so this property will not be
            // shown in the rendered markup when the web AdRotator is used to do
            // the rendering.
            _webAdRotator.Target = String.Empty;

            // Due to the fact that C# compiler doesn't allow direct
            // manipulation of event properties outside of the class that
            // defines the event variable, the way we delegate the event
            // handlers to the aggregated web control is to provide a wrapper
            // to capture the raised event from the aggregated control and
            // apply the event argument to the event handlers subscribed to
            // this class.
            AdCreatedEventHandler adCreatedEventHandler =
                new AdCreatedEventHandler(WebAdCreated);

            _webAdRotator.AdCreated += adCreatedEventHandler;
        }
Exemple #2
0
        protected virtual void OnAdCreated(AdCreatedEventArgs e)
        {
            AdCreatedEventHandler h = (AdCreatedEventHandler)Events [AdCreatedEvent];

            if (h != null)
            {
                h(this, e);
            }
        }