p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Professional ASP.NET 4 : in C# and VB (http://p2p.wrox.com/forumdisplay.php?f=554)
-   -   ch 16 code samples (http://p2p.wrox.com/showthread.php?t=80424)

tannnnna August 8th, 2010 12:01 AM

ch 16 code samples
 
code samples 2 & 3 ( & maybe others) in ch 16 reference a file, DailyLinks.ascx; the code is unusable without this file - the page won't work without it - where is it? ... also there is an image file reference, same problem

ps someone posted this same q almost two years ago - no answer

Imar August 8th, 2010 03:55 AM

Hi there,

I agree the file seems to be missing, and I think Wrox should be able to fix that.

However, I don't think the file is that relevant for this example. I think you can just create a simple user control called DailyLinks yourself, add a few links to it, and store it in the same folder as the main page is. It's just there - as far as I can see - to demo the capability of wrapping up your own User Controls.

Cheers,

Imar

chroniclemaster1 August 9th, 2010 02:14 PM

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.


All times are GMT -4. The time now is 01:02 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.