|
|
 |
| 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 p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.
|
 |

July 7th, 2009, 03:20 PM
|
|
Registered User
|
|
Join Date: Jul 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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"
Code:
<DataListID="AL"runat="server"DataKeyField="RefNumber"Width="100%">
<ItemTemplate>
<PanelID="AP"runat="server"GroupingText="Address"CssClass="Addr">
<TabContainerID="ATS"runat="server">
<TabPanelID="MemA"runat="server"HeaderText="Member">
<ContentTemplate> <p>
<LabelID="HPhLbl"Text="Home"runat="server"Width="75px"/>
<TextBoxID="HPh"runat="server"Text=' <%# ((DataRowView)Container.DataItem)["HomePhone"] %> ' />
</p>
Prior to adding the tabstrip everything loaded correctly, I justneed to understand how to assign values from a Datalist to controls, several containers deep.
Thanks!
|

July 14th, 2009, 12:58 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2007
Location: San Diego, CA, USA.
Posts: 278
Thanks: 0
Thanked 4 Times in 4 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.
|

July 14th, 2009, 11: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.
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |