all groups > asp.net building controls > march 2007 >
You're in the

asp.net building controls

group:

Why can't user controls be compiled into DLL and shared with other web applications


Re: Why can't user controls be compiled into DLL and shared with other web applications John Saunders
3/5/2007 1:35:30 PM
asp.net building controls:
[quoted text, click to view]

I don't think it's a technical reason, just a design reason. That's not what
user controls are for.

User controls are meant to be a simple way to build a composite control
without writing any code. They're not meant to be general purpose.

Now, at some time in the future, Microsoft could introduce a visual
composite control editor that might take the place of user controls for many
purposes, but user controls are meant to be more of a replacement for
server-side includes in ASP than they are meant to be real custom server
controls.

That said, it's not that difficult to write a composite control which is the
equivalent of a given user control. It takes longer and requires more
knowledge of controls, but it's not very difficult.

John

Why can't user controls be compiled into DLL and shared with other web applications Matt Adamson
3/5/2007 2:10:48 PM
Guys,

Does anyone know the technical reason why user controls couldn't be compiled
into an assembly and shared with other web applications.

If the ASP.NET compiler can compile the user control pages at runtime into
an assembly then why couldn't this be compiled and then shared with other
web applications. Perhaps we could write a module on top of ASP.NET which
could re use user controls in other web applications.

Thought?

Cheers

Matt

Re: Why can't user controls be compiled into DLL and shared with other web applications Steve C. Orr [MCSD, MVP, CSM, ASP Insider]
3/9/2007 4:20:24 AM
That's what Custom controls are for. Custom controls have great
reusability, but they're kinda hard to make.
User controls are only reusable within a single project but they are easy to
make.
Pick your poison.

Here's more info:
http://SteveOrr.net/faq/UserCustom.aspx

--
I hope this helps,
Steve C. Orr,
MCSD, MVP, CSM, ASPInsider
http://SteveOrr.net


[quoted text, click to view]
Re: Why can't user controls be compiled into DLL and shared with other web applications intrader
3/12/2007 6:34:08 PM
[quoted text, click to view]
Look at ScotsGu's tutorial on "Building Re-Usable ASP.NET User Control
and Page Libraries with VS 2006"
(http://weblogs.aps.net/scottgu/search.aspx?q=user+control&p=1)

I also have seen an approach of embedding the source of .ascx in a
AddThis Social Bookmark Button