In my application I am using UltaWebTab as usercontrol called TabControl.ascx and calling this user this control in a master page. The tabcontrol has two tabs. There is another aspx page, had a reference to master pages. I want to get an instance of TabControl and Tabs in the aspx page. Is it possible?
Basically, there is an UltraWebGrid in Tab1 with a hyperlink column. On the click of hyperlink column, the result should display in the next tab and not in a separate window. UltraWebgrid1 is also created as an UserControl in the master page. Currently it is displaying in a separate window which is not the requirement. If the UltraWebTabs be converted as container rather than usercontrol, can this be achieved? Please help.
Thanks,
Hello,
I hope I get the scenario right, but I believe you can do that by using the Page.Master property - contains a reference to the parent Master Page, and from there you can call FindControl to locate the Tab instance.
For example
Page.Master.FindControl("UltraTabControl1");
Thank you for the reply. I have done the same code , but the object is returned as null. I have done in the following ways.
u = (Infragistics.WebUI.UltraWebTab.UltraWebTab)Page.Master.FindControl("TabControl_UltraWebTab1");
u.Visible = false;
else { }
u = (Infragistics.WebUI.UltraWebTab.UltraWebTab)Page.Master.FindControl("TabControl");
Infragistics.WebUI.UltraWebTab.UltraWebTab obj = (Infragistics.WebUI.UltraWebTab.UltraWebTab)tstmst.FindControl("UltraWebTab1");
4) Infragistics.WebUI.UltraWebTab.UltraWebTab obj = (Infragistics.WebUI.UltraWebTab.UltraWebTab)tstmst.FindControl("TabControl_UltraWebTab1");
All the above is returned as null only. Could you please give any suggestions?
Thanks
Yes, I believe I may have an idea what is going on. FindControl is not recursive, e.g. if the Tab is nested in other server controls like panels, etc, you will need to first obtain the intance of the panel, and then of the Tab
e.g.
Page.Master.FindControl("Panel1").FindControl("Tab")
You can debug the page to show its control tree so that it is easier for you to see if the Tab is nested somewhere else.
Thank you for your continuing support and help.
Sorry for the long delay in reply of the above post. I was actually working on some other options also. The above didn't work well since the Tab control is inside a table in the master page. Even though I tried to access the tab using table id, I'm getting the casting error. Following is the short summary of my requirement. Sorry again for the long post. Please help me in resolving the issue. 1) There is a user control called TabControl.ascx which I have created two tabs, Search and Item Detail2) There is a master page which calls the above user control3) Master page contains only Header, Footer and Tab Control.3) There is a search panel in the startup page (Search.aspx) which contains a text box for entering the search strings and a button. 4) Upon clicking the button, a grid will display the results.5) The Grid, UltraWebGrid, which is again another user control and contains one hyperlink column.6) All the search panels and UltraWebGrid is in the Search.aspx which is the startup page.7) while clicking on one of the hyperlink column of UltraWebGrid, the result should display in the tab called ItemDetail.Currently, in the codebehind of UltraWebgrid.ascx, the code written for opening the hyperlilnk column of grid is:cell.Targeturl = "Detailed.aspx"8). Detailed.aspx is aspx page which calls again another user control ItemDetail.ascx. It is this usercontrol which implements all other functionality. This page doesn't contain any other functionality rather than just calling the user control ItemDetail.ascx.So I need to call the Detailed.aspx page in the tab 'Item Detail'. Rest of the things, ItemDetail.ascx will do. Even though I tried to get reference in the detail.aspx using FindControl method, it is returning as null. Please provide any help.Please let me know if you require any more clarification.Thanks
Thanks for the follow-up and for the detailed description of the problem. Iti s really hard for me to reproduce that, but I have another suggestion. You can implement your custom FindControl that is recursive and searches the whole control tree. In fact, I do have one such function in one of my projects - here is the code:
private Control FindControlRecursive(Control root, string id) { if (root.ID == id) { return root; } foreach (Control c in root.Controls) { Control t = FindControlRecursive(c, id); if (t != null) { return t; } } return null;
}
The you can call FindControlRecrusive for the whole Page or Master and see how it goes. e.g.
FindControlRecursive(Page, "UltraWebTab1");
or
FindControlRecrusive(Page.Master, "UltraWebTab1');
Thank you for the support. It has been fixed by using some javascript codes.