Web Custom control question

G

Guest

Hello,
Framework: NET 1.1, Language VB

So I am going through the basic walkthrough example in .NET on how to create
a simple custom control. Takes about 2 minutes and when done I have a DLL
that I can add to a toolbox in Web app.

Problem is, once the control is in my toolbox I cannot drag it onto a web
page!!! I get the dreaded 'O' with a line through it. I also tried in HTML
view but when I switch to Design view I get a box displaying 'Error Creating
Control'.

What am I missing or doing wrong???

Thanks - Hedge
 
D

Dave Sexton

Hi Tony,

Create an empty class that derives from System.Web.UI.Control and you've
made a custom control, although it doesn't do anything special.

public class MyControl : System.Web.UI.Control
{
}

Now, does your empty Control appear in the Toolbox? If not, add your .dll
to the Toolbox by browsing to your assembly on the .NET tab of the toolbox
customization dialog. Your assembly will not be listed so you must browse
for it.
Can you use it on a web form by dragging the Control from the Toolbox and
dropping it onto the Form?

What have you done in your custom control other than just deriving from
System.Web.UI.Control?
 
G

Guest

Hi Dave,

I've changed nothing, that's what's puzzling.

It does appear in the toolbox, it's when I go to drag in on a form that's
the problem.

As I'm dragging the control from the toolbox to the form, the cursor changes
to the O with the slash through it as soon as I cross the boundary from the
Toolbox to the form.
 

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

Top