View Single Post
  #3 (permalink)  
Old August 9th, 2010, 02:14 PM
chroniclemaster1 chroniclemaster1 is offline
Friend of Wrox
Points: 1,749, Level: 16
Points: 1,749, Level: 16 Points: 1,749, Level: 16 Points: 1,749, Level: 16
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2007
Location: San Diego, CA, USA.
Posts: 477
Thanks: 10
Thanked 19 Times in 18 Posts

Yeah, Imar's right, the file is not strictly necessary, any user control will do. While they're a great way to build a complete component (because you can encapsulate all the code to make it work in the code behind for the .ascx file) user controls are great as a way to encapsulate simple XHTML code that you need to spread across the website. Generally master pages make a better choice, but if there are several alternate controls which should go in different locations, it's possible a combo approach would be most efficient. Write a content placeholder control in the master page and insert the default user control that should appear on most pages. However, each content page can control its display. If you don't include a content tag with that placeholder's name, the page will display with the default user control. If you specify the content tag but leave it empty, the content page will not display the default control (or anything else in that spot), or you can specify the content tag and call an alternate user control (or even just write custom XHTML). Very flexible.

Whatever you can do or dream you can, begin it. Boldness has genius, power and magic in it. Begin it now.
-Johann von Goethe

When Two Hearts Race... Both Win.
-Dove Chocolate Wrapper

Chroniclemaster1, Founder of
A Growing History of our Planet, by our Planet, for our Planet.