I think you have to work your way through the control collections (forgive me if I'm using the wrong phases). I have a TabContainer which I dynamically add TabPanels to, on each tab I add an UpdatePanel and a PlaceHolder within each UP, in each PH I added
a label.
If I want to change the text of the label I have to do the following (in VB.NET):
Sub AddContent(ByVal strTabID As String)
Dim tabProcesses As TabContainer = Page.FindControl("tabProcesses")
Dim TempTab As TabPanel = tabProcesses.FindControl("tab" & strTabID)
Dim TempUpdatePanel As UpdatePanel = TempTab.FindControl("up" & strTabID)
Dim TempPlaceHolder As PlaceHolder = TempUpdatePanel.FindControl("ph" & strTabID)
Dim TempLabel As Label = TempPlaceHolder.FindControl("lbl" & strTabID)
TempLabel.Text = strTabID
TempUpdatePanel.Update()
End Sub
As you can see I am basically finding each control then finding the next within it.
There are probable better ways which I would be keen to see but this works for now,
chafen
Member
2 Points
3 Posts
Re: How to find controls inside a TabPanel's ContentTemplate?
Mar 05, 2007 02:58 PM|LINK
I think you have to work your way through the control collections (forgive me if I'm using the wrong phases). I have a TabContainer which I dynamically add TabPanels to, on each tab I add an UpdatePanel and a PlaceHolder within each UP, in each PH I added a label.
If I want to change the text of the label I have to do the following (in VB.NET):
Sub AddContent(ByVal strTabID As String) Dim tabProcesses As TabContainer = Page.FindControl("tabProcesses") Dim TempTab As TabPanel = tabProcesses.FindControl("tab" & strTabID) Dim TempUpdatePanel As UpdatePanel = TempTab.FindControl("up" & strTabID) Dim TempPlaceHolder As PlaceHolder = TempUpdatePanel.FindControl("ph" & strTabID) Dim TempLabel As Label = TempPlaceHolder.FindControl("lbl" & strTabID) TempLabel.Text = strTabID TempUpdatePanel.Update() End Sub