Reusable controls...missing something?

I

intrepid_dw

Hello...

We are in the process of evaluating a migration strategy to VS2005 and
ASP.NET 2.0 from .NET 1.1.

In our existing .NET 1.1 applications, we have several controls
(ASCX's) that provide stock content to several websites. We want to
persist that idea into our newer and/or migrated applications, eg build
a control to contain the text (and some small javascript code) in one
place, then put that control in a library, then just pull that control
out on to our pages on the various websites.

What we're seeing, however, leads us to believe that the best we can
really hope for is to create such controls repetitively among each
website that might use them. Master Pages seemed like the next logical
step, but again, our observation leads us to believe they're
constrained to a single site. We want to be able to reuse code across
*multiple* sites.

The notion of having to maintain copies of the same code across
multiple sites seems to defeat the whole purpose of having libraries of
nice, reusable code; if the text on these stock controls has to change,
we have to change it for each website that uses it. Ugh. That doesn't
make any sense to us, so I have to assume I'm just being dense about
the intended process.

What is the proper approach, if one exists?

Thanks,
intrepid
 
T

Tim_Mac

hi intrepid,
you certainly shouldn't have to duplicate code, in the scenario you have
described.
if you use master pages, you could very simply drop the control from your
library onto the master page. that seems so simple it makes me wonder if i
am missing the point of your question? the 'child' pages can access any
controls on their master page and modify them accordingly.

if you don't want to use master pages you could use the same model as you
use in 1.1, just drop the control onto each page you want to.

i found the migration quite a big deal myself, with plenty of "why did they
do it this way!!!" questions, but you get used to it and can see the
benefits after you are familiar with the new techniques.

tim
 
G

Guest

If you use the Web Application Projects add-in, you can compile all your ASCX
usercontrols' codebehind into a single assembly. Then, to use these in a
separate web site, all you need to do is drop that assembly for your controls
into the /bin folder and copy the .ASCX files there.
Peter
 
I

intrepid_dw

Peter:

*That* sounds like a great suggestion, Peter. We'll give that a try. It
sounds exactly like what we want to do.

-Intrepid
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top