Custom web control problem

J

Jim Buck

I built a custom web control and can add it to the
toolbox. However when I drag the control onto a web form
niether the control tags nor the "register" directive get
created. My class looks like the following, does anyone
know what could be wrong. The custom control and the form
are in different assemblies.

[ToolboxItem(true),
DefaultProperty("Name"),
ToolboxBitmap(typeof
(MyControl), "ToolboxBitmaps.MyControl.bmp"),
ToolboxData("<{0}:MyControl runat=server></
{0}:MyControl>")]
public class MyControl : CustomControl
{

// Ommitted
}
 
J

Jim Buck

I figured out the problem.

The default ToolboxItem type, which is used when you send
true to the ToolBoxItemAttribute constructor is the
ToolBoxItem. However since I am writing a web control I
needed to use WebControlToolboxItem.

Thanks
 
J

John Saunders

Jim Buck said:
I figured out the problem.

The default ToolboxItem type, which is used when you send
true to the ToolBoxItemAttribute constructor is the
ToolBoxItem. However since I am writing a web control I
needed to use WebControlToolboxItem.

Thanks

No. Thank YOU!

I was wondering why my ToolBoxData wasn't working! Now I know.

Where did you find this out? Maybe the answers to my other control mysteries
are there as well. :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top