public void AddButton() { // Add a standard button. Button b = new Button(); b.Text = "New standard button"; RootDesigner.AddControlToDocument(b, null, ControlLocation.First); }
public void AddNewButton() { // Add your custom button. NewButton b = new NewButton(); b.Text = "New custom button"; // For buttons defined in a different assembly, add the // register directive for the referenced assembly. // assembly. By default, this goes to the document, unless // already defined in the document or in configuration. WebFormsReferenceManager wfrm = RootDesigner.ReferenceManager; wfrm.RegisterTagPrefix(b.GetType()); RootDesigner.AddControlToDocument(b, null, ControlLocation.Last); }