UserControl as unit of reuse - problems

O

Oliver

hi all -
- I'm probably a) completely wrong b) the umpteenth person too
mention it - but I'm struggling to identify how to best work with
re-usable units of UI on an ASP page.

the problem is really:
1) UserControl - perfect *but* can't be re-used site wide - I *must*
be wrong on this surely...

2) Custom Control - perfect for some things - like sophisticated
controls, but I don't want to use these for everything - I'd like my
site(s) to be build almost entirely of re-usable components

any hints appreciated
Oliver
 
S

S. Justin Gengo

Oliver,

I think you've got it about right. You are wrong about user controls. They
can be used site wide, but the key here is that they are application
specific. If you site is broken up into multiple applications you'll want to
use server controls instead. Yes, they are more complex, but you can use
them anywhere. That's the trade off.

Another option to create controls quickly is to use inheritance. For
example, if you need a text box to do something special, create a class
library, inherit the text box control already built into .Net and then
modify it.

Sincerely,

--
S. Justin Gengo, MCP
Web Developer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
 
J

Jos

Oliver said:
hi all -
- I'm probably a) completely wrong b) the umpteenth person too
mention it - but I'm struggling to identify how to best work with
re-usable units of UI on an ASP page.

the problem is really:
1) UserControl - perfect *but* can't be re-used site wide - I *must*
be wrong on this surely...

2) Custom Control - perfect for some things - like sophisticated
controls, but I don't want to use these for everything - I'd like my
site(s) to be build almost entirely of re-usable components

any hints appreciated
Oliver

Other key differences are:
- Custom Controls can raize their own events
- Custom Controls can be added to the toolbox, both in VS.NET and
Web Matrix.
- The custom properties for Custom Controls can also be set from the
Properties pane in these editors.
For User Controls you'll have to hand-code these properties.
 

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,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top