Reusable ASP.NET User Controls!?!?

  • Thread starter Thread starter DaveOnSEN
  • Start date Start date
D

DaveOnSEN

I love how easy it is to develop ASP.NET user controls. They are fast
to make and easy to reuse within your web application. However,
sometimes I want to make controls that I use in one web application and
I want to reuse them in another application. However, I can't figure
out how to put them into any kind of library. Is it even possible? I'd
like the reusability across projects of Custom Controls with the
simplicity and elegance of User Controls. How can I achieve this?
Thank you.

David




Meet people for friendship, contacts,
or romance using free instant messaging software! See a picture you
like? Click once for a private conversation with that person!

www.socialnetwork.com
<a href="http://www.socialnetwork.com">SocialNetwork.com</a>
 
I love how easy it is to develop ASP.NET user controls. They are fast
to make and easy to reuse within your web application. However,
sometimes I want to make controls that I use in one web application and
I want to reuse them in another application. However, I can't figure
out how to put them into any kind of library. Is it even possible? I'd
like the reusability across projects of Custom Controls with the
simplicity and elegance of User Controls. How can I achieve this?

The problem is that user controls generally need their accompanying ASCX
file. You could write a user control totally in code, but that might be
more trouble than it's worth. There's no real problem with creating user
controls as libraries otherwise. Just create a library project in your
desired language, and include the relevant references and imports.
 
That doesn't really give you code-reuse though in my opinion. As I
understand it, if you develop a user control the ascx and code need to be
included in the application's project, which means if you want to use the
same user control in more than one app, the ascx and code reside as copies
of each other in each project. That's not re-use, that's copy and past.

If you truly want re-use I think you need to build a custome server side
control so you can compile it to a dll, and then you can reference that dll
from all sorts of apps. The downside is you need to code the interface
rather than design it in a forms designer.
 
Umm.. that's basically what I said.

That doesn't really give you code-reuse though in my opinion. As I
understand it, if you develop a user control the ascx and code need to be
included in the application's project, which means if you want to use the
same user control in more than one app, the ascx and code reside as copies
of each other in each project. That's not re-use, that's copy and past.

If you truly want re-use I think you need to build a custome server side
control so you can compile it to a dll, and then you can reference that dll
from all sorts of apps. The downside is you need to code the interface
rather than design it in a forms designer.
 
Back
Top