Hello Paul,

If you are using ASP.NET 2.0 you could instead inherit from
CompositeControl, which in turns derive from WebControl and implements
INamingContainer, this last one allowing to handle postback events
correctly inside child controls. This class is well suited for controls
like the one you showed us. I think, however, that implementing
INamingContainer alone in your own class would solve your issue: please
note that I've assumed that *Render() methods you called do not render
anything directly but, instead, add controls to the Controls collection
of the main control.

Of minor relevance, I've noticed that you set up main control properties
(like CssClass) inside CreateChildControls(); IMHO this is not the best
place to do it and OnInit() would be more appropriate and cleaner.

HTH,

Efran Cobisi
http://www.cobisi.com

Paul Cowan wrote:
I am creating a composite custom control that inherits from WebControl.

I am overriding Controls like this:

public override ControlCollection Controls
{
get
      {
            EnsureChildControls();
            return base.Controls;
      }
}

I am then overriding CreateChildControls like this:

protected override void CreateChildControls()
{
Controls.Clear();
      this.CssClass = "rating";
      HtmlGenericControl header = new HtmlGenericControl("h2");
      header.InnerText = MainTitle;
      Controls.Add(header);
      base.SpacerControlAdd();
      CurrentRatingRender();
      HtmlGenericControl hrDiv = new HtmlGenericControl("div");
      hrDiv.Attributes.Add("class", "hr");
      hrDiv.Controls.Add(new LiteralControl("<hr/>"));
      Controls.Add(hrDiv);
      SpacerControlAdd();
      UserRatingImagesRender();
}

The last method UserRatingImagesRender, renders a number of ImageButtons.

I am adding command values to the buttons like this:

result.CommandName = "rate";
result.CommandArgument = rating.ToString();

I want to intercept these ImageButton’s click events so I thought I would 
override OnBubbleEvent but the problem is that the event is not firing whenever 
I click one of the buttons.Does anyone know what is wrong or how I can 
intercept the click events?
Cheers
[EMAIL PROTECTED]
_________________________________________________________________
Invite your mail contacts to join your friends list with Windows Live Spaces. 
It's easy!
http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us
===================================
This list is hosted by DevelopMentor®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com


===================================
This list is hosted by DevelopMentor®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to