Al.
Al.

Reputation: 875

Having user control in dll and use it

Is it possible to have an usercontrol(.ascx) in class libaray(dll) and use the control in other project by referencing the dll. If its not possible or advisable, how should i write my control in a such a way that outside projects can reuse it. Any suggestion would really helpful

Upvotes: 3

Views: 4110

Answers (2)

HatSoft
HatSoft

Reputation: 11201

Yes you can kind of do it by using the asp_net complier option for .ascx

Please see this article on msdn gives you step by step details how to do

http://msdn.microsoft.com/en-us/library/aa479318.aspx

Upvotes: 1

Orn Kristjansson
Orn Kristjansson

Reputation: 3485

Just make sure the properties and functions are public. Then reference the dll from your project and use the control just like you would if it resided in the same project. If this is a control you are going to use from more than one project I would say yes it's a good choice to create a dll and reference it.

Upvotes: 1

Related Questions