Adding a web user control to a class library project in .Net 2.0 (2005)

By matt_india ·
In .Net 1.1 I would create a server control plugin by creating a class library project with a class that represents my control.

To abstract the actual user interface I would often include a web user control .ascx within the class libarary and call upon it in the class.
Now by default you don't get the option to add a web user control to a class library but this can be overcome by copying one from a web project.

I'm now developing my first .Net 2.0 server control plugin and would like to do the same thing.
Similarly the IDE does not let you add a web user control to a class library but you can copy it from another project like before or
use the tip suggested here

Either way I cannot get ascx code to go in the code behind file for the ascx.

For example:
Create a new class library project in .Net 2005.
Create a new website project.
Add a web user control to the web site project.
Copy the web user control to the class library.
Add a button to the web user control in the class library.
Double click the button and it will add the click handler code inline to the .ascx rather than the .ascx.cs or .ascx.vb.

How can I get the code behind to work?



This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Share your knowledge

Related Discussions

Related Forums