Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.1
|
ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.1 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 15th, 2004, 07:42 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default Composite Controls and INamingContainer

Hello,

I was working with a composite control, that for the life of me wasn't working at all. I added "Implements INamingContainer" and it works fine. Any ideas why that is? That really peaked my curiosity.

Thanks,

Brian Mains
__________________
Brian
 
Old April 15th, 2004, 08:19 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Brian,

Where you working with nested controls?
The INamingContainer takes care of generating unique names within the entire page scope. So, if you have a TextBox inside a Repeater, this class makes sure that each TextBox gets a unique name in each Repeater item by prefixing the TextBox with the Repeater name / ID.

Simply implementing INamingContainer enables this behavior for your own controls.

HtH,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Suck it Up by Hed Planet Earth (Track 1 from the album: Blackout )
 
Old April 15th, 2004, 08:52 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hey,

Thanks for the response. I had a control that had a label, two textboxes, two labels, and a link button. However, after reading your response, it dawned on me that I used several LiteralControls to output HTML for a table element that would format these controls, and I bet that is what is causing the problems.

Thanks,

Brian
 
Old April 15th, 2004, 09:06 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

You can take a look at the source of the page in the browser. If you see ID values with a colon, e.g.: myDataGrid:_ctl8:btnDelete you can be sure you had the INamingContainer at work.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Revelations by Hed Planet Earth (Track 14 from the album: Blackout )






Similar Threads
Thread Thread Starter Forum Replies Last Post
AssociateControlID problem with Composite Controls ctt BOOK: Professional ASP.NET 2.0 Server Control and Component Development ISBN: 978-0-471-79350-2 0 May 12th, 2008 11:06 AM
Composite Controls origjones General .NET 2 August 31st, 2006 09:58 AM
INamingContainer and New Id rendering. andkmr ASP.NET 1.x and 2.0 Application Design 0 March 22nd, 2006 01:31 PM
Composite Control bmains .NET Framework 2.0 0 July 25th, 2005 12:57 PM





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