Composite control with design-time support

I think I may have reached a point in my development needs where I need greater control, flexibility and power than an .ascx can provide.

But I need a good guide to help me make the transition.  What I need are some good resources for getting my head around custom composite controls with design-time support.

I want to group a bunch of controls and html elements together as a single unit plus have design-time support, such that I can position those elements within the custom control itself.

How can I do this?  I welcome websites and book recommendations and any advice you can give.
//MY COMPLAINT IS THAT THE TEXT BOXES IN THIS SAMPLE (gotton off of MSDN) DO NOT SHOW-UP WHEN I DROP THE CONTROL ONTO A WEB PAGE.  I WANT THEM TO BE VISIBLE AT DESIGN-TIME AND WHEN I CLICK ON THEM I WANT TO SEE THEIR PROPERTIES IN THE PROPERTIES WINDOW.
 
 
using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
 
namespace WebControlLibrary1 
{
      
      public class Composite : Control, INamingContainer 
      {
            private int number = 100;
            private Label label;
            
            public int Number
            {
                  get
                  {
                        return number;
                  }
                  set
                  {
                        number = value;
                  }
            }
            
            private int Sum
            {
                  get 
                  {
                        EnsureChildControls();
                        return Int32.Parse(((TextBox)Controls[1]).Text) + 
                              Int32.Parse(((TextBox)Controls[4]).Text);
                  }
                  
            }
 
            public string Text
            {
                  get
                  {
                    EnsureChildControls();
                        return label.Text;
                  }
                  set
                  {
                    EnsureChildControls();
                        label.Text = value;
                  }
            }
            
            
            public event CheckEventHandler Check;
            
            protected virtual void OnCheck(CheckEventArgs ce)
            {
                  if (Check != null)
                  {
                        Check(this,ce);
                  }
            }
            
            protected override void CreateChildControls() 
            {
                  
                  Controls.Add(new LiteralControl("<h3>Enter a number : "));
                  
                  TextBox box1 = new TextBox();
                  box1.Text = "0";
                  Controls.Add(box1);
                  
                  Controls.Add(new LiteralControl("</h3>"));
                  
                  Controls.Add(new LiteralControl("<h3>Enter another number : "));
                  
                  TextBox box2 = new TextBox();
                  box2.Text = "0";
                  Controls.Add(box2);
                  
                  Controls.Add(new LiteralControl("</h3>"));
                  
                  Button button1 = new Button();
                  button1.Text = "Submit";
                  Controls.Add(new LiteralControl("<br>"));
                  Controls.Add(button1);
                  button1.Click += new EventHandler(this.ButtonClicked);
                  
                  Controls.Add(new LiteralControl("<br><br>"));
                  label = new Label();
                  label.Height = 50;
                  label.Width = 500;
                  label.Text = "Click the button to see if you won.";
                  Controls.Add(label);
                  
            }
            
            protected override void OnPreRender(EventArgs e)
            {
                  ((TextBox)Controls[1]).Text = "0";
                  ((TextBox)Controls[4]).Text = "0";
            }
            
            private void ButtonClicked(Object sender, EventArgs e)
            {
                  OnCheck(new CheckEventArgs(Sum - Number));
            }
      }
}

Open in new window

LVL 5
Tom KnowltonWeb developerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

DropZoneCommented:
In order for a custom composite control to have support in the visual designer,  you need to create a "designer" for it.  In essence, this is a control that instantiates an object of your custom class, in its default state, when the visual designer displays it.

Here are a few sites to help you get started:
http://www.theserverside.net/developmentor/thread.tss?thread_id=25025
http://msdn2.microsoft.com/en-us/library/12yydcke.aspx
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Tom KnowltonWeb developerAuthor Commented:
This link is to a white paper, but I don't seem to have rights to view it:
http://www.theserverside.net/developmentor/thread.tss?thread_id=25025

I am making my way through the walkthrough given in the other link -- thank you...
0
DropZoneCommented:
Sorry about that.  I guess they pulled the PDF file (I got an error on viewing it too now).

Here is another link for you:
http://msdn2.microsoft.com/en-us/library/aa478960.aspx

The following book is *extremely* good, but it's out of print.  It also relates to .NET 1.1, but the theory of doing things is still the same in .NET 2.0.  I believe there is a newer edition for 2.0, but I'm not sure.

http://www.microsoft.com/MSPress/books/5728.aspx
    -dZ.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.