How to put a Custom Control on the toolbox.

C

craigkenisston

I created a derived class from "Literal". I put the code in the
App_Code folder and the control is working as expected.

Now, I wan this control to be in the ToolBox, just like the others,
what do I need to do ?
Should it be in a separate library file to be able to get this ?

Thanks in advance,
 
G

Guest

You probably just need to add a "ToolboxData" attribute above the class
definition. I don't have the syntax handy, but you can search it and find
numerous examples.
Peter
 
C

craigkenisston

For what it said in the documentation, I think that attribute is for
when you already have it in the Toolbox:

"Specifies the default tag generated for a custom control when it is
dragged from a toolbox in a tool such as Microsoft Visual Studio. "

I'm talking about putting the custom control in the toolbox.

Regards,
 
G

Guest

Correct. If your control is built correctly, all you need to do is
right-click on the Toolbox section where you want your control, choose
"Add/Remove Items", and browse to your built control's assembly. In ASP.NET
2.0, if the control project is in your Web Application, this happens
automatically.

Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com
 
C

craigkenisston

Which control's assembly ?
The code is part of the application. That _is_ my question.
Do I need to have in a separated from the asp.net code, in its own
class library ?
Well, it seems yes.


Regards,
 

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,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top