sharing usercontrols across projects

D

darrel

Is it practical?

I have a site we've been working on where a lot of the objects on the page
are usercontrols...the header, the footer, navigation, etc.

I need to make a stand-alone mini-site that should not be connected to the
larger project, as it will be maintained by a different group by hand.

So, I was just going to copy over a few of the controls and place them in
here. Of course, that's easy, but not ideal, as now I have duplicates of the
exact same control. Is it possible to reference a control outside of your
own project?

-Darrel
 
C

Chris Austin

Darrel,

If you want to share controls between projects and not duplicate the code,
then you need to create a Custom Server Control library. You will not have
the luxury of having a .ascx file to define your HTML in, thus the
complexity rating of the task goes up. But, if you are like me after you
get over the learning curve then you start to favor custom controls over
user controls. You will have to implement either the Render method or the
CreatChildControls method. Render() method is used when you just would like
to utilize the HtmlTextWriter class and CreateChildControls is used when
creating a composite control.

The other thing you end up having to make when you do a custom control
library is create Designer classes for each of your controls so you can see
your controls in a certain way while view the web form in the designer.

Here is a nice index page of information that you will need to help you
along with this task.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vboriwebusercontrols.asp

HTH
-Chris
~
http://weblogs.austinspad.com/caustin
 

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top