How to put a Custom Control on the toolbox.

  • Thread starter Thread starter craigkenisston
  • Start date Start date
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,
 
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
 
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,
 
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
 
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,
 
Back
Top