Global User Controls

J

Jeff Tolman

Hi!

I'm trying to understand how I can use a UserControl across projects.
Basically it's a Header.ascx file (along with the code-behind .vb file).
I'd like to be able to use this header in several projects for a web site.
Do I have to import the component files into every project? Or is it
possible to create a control library even though it has an .ascx file? I
guess I'm just not understanding how you can modularize ASP.NET pages with
the .ascx controls. Can someone give me a quick summary?

Thanks to all!

Jeff Tolman
E&M Electric
 
D

Dave Rothgery

Jeff Tolman said:
Hi!

I'm trying to understand how I can use a UserControl across projects.
Basically it's a Header.ascx file (along with the code-behind .vb file).
I'd like to be able to use this header in several projects for a web site.
Do I have to import the component files into every project? Or is it
possible to create a control library even though it has an .ascx file? I
guess I'm just not understanding how you can modularize ASP.NET pages with
the .ascx controls. Can someone give me a quick summary?

It's kind of messy, and doesn't get any kind of designer support, but it's
possible.

First, add a reference to the project containing the ascx.
Second, create a virtual directory underneath the virtual directory
containing your aspx, which points to the directory with your ascx in it
(say that three times fast).

After that, you can add your ascx to your aspx by hand-coding it.
 
J

Jeff Tolman

Hey Dave!

I think I got most of that except the last part about adding the ascx by
hand-coding it. Can you give an example of that?

Thanks.

Jeff
 

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,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top