UserControl as unit of reuse - problems

  • Thread starter Thread starter Oliver
  • Start date Start date
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
 
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
 
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.
 
Back
Top