I have a .ascx control that contains my UltraWebTab and within my UltraWebTab i have 4 tabs that are each a control. i am trying to pass 2 properties from the main page to each tab and for the licfe of me can not figure out how to get them into the tab controls. i can get them from the main page into the control that contains the UltraWebTab but i can nto get them from there tio the individual tabs.
any thougths, suggestions?
i'm using 9.2 btw
Hi Shawn,
If I understood correctly you want to find reference to a child control located in ContentPane of TabItem. If that is the case, then you should use standard method of dot-net FindControl. Since you have chain of naming containers, you should search through all of them in exact order. For example, you have TextBox2 located in first tab of WebTab located in WebUserControl2. Below are codes to get reference to that field:
WebUserControl2 user = this.FindControl("WebUserControl21") as WebUserControl2; if(user == null) return; Infragistics.WebUI.UltraWebTab.UltraWebTab webtab = user.FindControl("UltraWebTab1") as Infragistics.WebUI.UltraWebTab.UltraWebTab; if(webtab == null) return; TextBox tbOnTab1 = webtab.Tabs.GetTab(0).FindControl("TextBox2") as TextBox; if(tbOnTab1 != null) tbOnTab1.Text = "ok";
Viktor,
Can you help with a similar problem finding control within a WebTab (not an UltraWebTab)?
WebTab seems to have no ("Tabs.GetTab(0).FindControl") string. I can use "Tabs[1].FindControl", but the control name comes up with an "Object not set to an instance" error.
I'm not trying to set control values, by the way, I'm trying to retrieve them.
thanks,
Badger98023
Hi Badger98023,
That method was missed to be implemented. It think it will be added to tabItem of WebTab. For now, I suggest you to mimic its implementation by (a static) method:
protected void Page_Load(object sender, EventArgs e) { Control child = FindControlRecursive(this.WebTab1.Tabs[0], "TextBox1"); }
private Control FindControlRecursive(Control cc, string id) { if(cc == null || !cc.HasControls()) return null; foreach(Control child in cc.Controls) { Control c = child.FindControl(id); if(c != null) { id = id.ToLower(System.Globalization.CultureInfo.InvariantCulture); string cID = c.ID.ToLower(System.Globalization.CultureInfo.InvariantCulture); if(id.Equals(cID) || id.EndsWith(":" + cID) || id.EndsWith("$" + cID)) return c; } if((c = this.FindControlRecursive(child, id)) != null) return c; } return null; }