This is a migrated thread and some comments may be shown as answers.

Accessing Controls inside Templates

1 Answer 64 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Lukus
Top achievements
Rank 1
Lukus asked on 05 Apr 2011, 06:57 PM
I am trying to do some client-side validation over 4 different tabs.  I can get the tabstrip and the tab elements just fine but when I try to find a specific control inside a given tab it is unable to find it.  Here is what I have.

var tabstrip = $find("<%=RadTabStrip1.ClientID %>");
var tab      = tabstrip.findTabByText("Statistics");
var amount   = tab.findControl("txt_amount");

"txt_amount" is the ID of a TextBox in a tab named "statistics."  Any suggestions would be greatly appreciated. 

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 06 Apr 2011, 05:51 AM
Hello Lukos,
I could not find any direct method to access  normal asp controls from client side. One suggestion is to use RadTextBox and access it using findControl().
<telerik:RadTabStrip ID="RadTabStrip1" runat="server" SelectedIndex="0">
<Tabs>
 <telerik:RadTab runat="server" Text="Products" Selected="True" SelectedIndex="0">
     <TabTemplate>
      <telerik:RadTextBox ID="radTextBox1" runat="server"></telerik:RadTextBox>
      </TabTemplate>
</telerik:RadTab>
<telerik:RadTab runat="server" Text="Tours">
</telerik:RadTab>
    </
Tabs>
</telerik:RadTabStrip>
Javascript:
function findTextBox()
{
    var tabStrip = $find("<%= RadTabStrip1.ClientID %>");
    var tab = tabStrip.findTabByText("Products");
    var toolBar = tab.findControl("radTextBox1");
}

Thanks,
Shinu.
Tags
TabStrip
Asked by
Lukus
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or