Hi
I have a webtab, in which the tabs and its contents are added dynamically based on the some criteria. In javascript I have to find a control whether it exists or not with in tab(which may be in any of the tabs dynamically). If exists I have to get the tab index for selecting the tab in javascript. Than I have to focus that control. Please let me know the way.
Thanks in advance.
Hi Sridhar,
The Tab object on client has findControl member method which returns reference to html element located in tab from its partial id. Below is example to use it.
<script type="text/javascript"> function focusTo(id) { var webTab = igtab_getTabById('<%=UltraWebTab1.ClientID%>'); if(!webTab) return; var i = webTab.Tabs.length; var textBox = null; while(i-- > 0) { textBox = webTab.Tabs[i].findControl(id); if(textBox) break; } if(i < 0) return; webTab.setSelectedIndex(i); textBox.focus(); } </script> <igtab:UltraWebTab ID="UltraWebTab1" runat="server" Height="149px" Width="245px"> <Tabs> <igtab:Tab Text="New Tab"> <ContentTemplate> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> </ContentTemplate> </igtab:Tab> <igtab:Tab Text="New Tab"> <ContentTemplate> <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox> </ContentTemplate> </igtab:Tab> </Tabs> </igtab:UltraWebTab> <input ID="Button1" type="button" value="focusTo TextBox1" onclick="focusTo('TextBox1')" /> <input ID="Button3" type="button" value="focusTo TextBox2" onclick="focusTo('TextBox2')" />