[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.webcontrols

Custom user control in separate DLL

Sergey L.Ponomarev

1/4/2003 3:44:00 PM

I wrote user control using ASCX file with code-behind in my web project. Is
there any way to place this control into library DLL so I will be able to
use it in a different application? May I incorporate ASCX file into DLL or I
not?

Best regards,
Sergey


1 Answer

Jesse Ezell

1/4/2003 9:16:00 PM

0

If you want to enable reuse of your controls in DLLs, you
need to use Composite Controls instead of User Controls.

These controls are harder to author, because you do not
currently get to use the VS.NET designers to make them.
You need to create a class that derives from
System.Web.UI.Control or a sub-class of it, such as
System.Web.UI.WebControls.WebControl.

Override the protected member, CreateChildControls and
add the code to insert your controls in the Control
collection of the class.

A nice addition is that you can enable full designer
support for Composite Controls, which you cannot enable
on ascx files. All the controls that come with ASP.NET
are composite controls.

--Jesse