Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Building Controls / March 2007

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Matt Adamson - 05 Mar 2007 14:10 GMT
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
John Saunders - 05 Mar 2007 18:35 GMT
> Guys,
>
[quoted text clipped - 5 lines]
> web applications. Perhaps we could write a module on top of ASP.NET which
> could re use user controls in other web applications.

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
Steve C. Orr [MCSD, MVP, CSM, ASP Insider] - 09 Mar 2007 12:20 GMT
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

Signature

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

> Guys,
>
[quoted text clipped - 11 lines]
>
> Matt
intrader - 13 Mar 2007 02:34 GMT
> Guys,
>
[quoted text clipped - 11 lines]
>
> Matt

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
resource. This resource gets compiled on the fly.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.