Question

Locked

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 http://haacked.com/archive/2006/02/07/AddingWebUserControlToAClassLibraryInVS.NET2005.aspx

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?

Thanks,

Matt

This conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Share your knowledge
Back to Networks Forum
2 total posts (Page 1 of 1)  

Related Discussions

Related Forums