Wrox Programmer Forums
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional 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 July 7th, 2009, 02:20 PM
Registered User
Join Date: Jul 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Nested Container control binding

I am using the AjaxControlToolkit and I have several controls that are inside a TabPanel, within a TabContainer. The TabContainer is in a Panel, which is nested in a DataList. (see aspx code below).
The Datalist contains my DataRow, and I need to figure out how to access the DataList to set values in the Tabs child controls from the aspx. Somehting like "Container.Parent.Parent.Container.DataItem" or "Container.Container.DataItem"

             <ContentTemplate>                   <p>
                  <TextBoxID="HPh"runat="server"Text=' <%# ((DataRowView)Container.DataItem)["HomePhone"] %> ' />
Prior to adding the tabstrip everything loaded correctly, I justneed to understand how to assign values from a Datalist to controls, several containers deep.

Old July 13th, 2009, 11:58 PM
Friend of Wrox
Join Date: Jun 2007
Posts: 477
Thanks: 10
Thanked 19 Times in 18 Posts

I've tried to build some controls similarly using nested repeaters and had problems, I'm guessing for the same reasons. Somebody mentioned using the FindControl method, but that just threw different errors. I returned for more insight, but all I got was "FindControl is evil, so don't use it. It's bad practice." Unfortunately there was no explanation why or what to use instead.

I'm hoping we can both get some answers here. ;)

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 www.EarthChronicle.com
A Growing History of our Planet, by our Planet, for our Planet.
Old July 14th, 2009, 10:53 AM
Registered User
Join Date: Jul 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

FindControl can work when drilling down, but it is not recursive, it only looks in the container in which you call it from, and recursively calling it from the page level would be bad. In this case I'm trying to figure out a way to drill "up" to parent/grand parent/... naming containers. So I hope some one does reply who know the answer.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with binding XMl data into nested repeater vishnu108mishra XML 0 November 19th, 2007 03:53 AM
Container Binding problem tany4u Javascript How-To 0 October 3rd, 2006 01:36 AM
Is there a container control in VBA? sangeenobs Beginning VB 6 1 March 23rd, 2006 10:57 AM
Custom Container Control bmains .NET Framework 2.0 0 April 20th, 2005 02:01 PM

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