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

Accessing control values

1 Answer 55 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Paula
Top achievements
Rank 1
Paula asked on 06 Jul 2010, 04:10 PM
I want to have a tabstrip with a text box on it but I cant access the value of the textbox in code behind.  What am I missing? This should be simple but I cannot find the answer anywhere.

 

<telerik:RadTabStrip ID="RadTabStrip1" runat="server" SelectedIndex="0">

 

 

<Tabs>

 

 

<telerik:RadTab runat="server" Selected="True" Text="test">

 

 

<TabTemplate>

 

 

<asp:TextBox ID="TextBox1" runat="server" ontextchanged="TextBox1_TextChanged"></asp:TextBox>

 

 

<asp:LinkButton ID="LinkButton1" runat="server" onclick="LinkButton1_Click">LinkButton</asp:LinkButton>

 

 

</TabTemplate>

 

 

</telerik:RadTab>

 

 

</Tabs>

 

 

</telerik:RadTabStrip>

 



 

Protected Sub LinkButton1_Click(ByVal sender As Object, ByVal e As System.EventArgs)

 

 

Dim rad As TextBox = RadTabStrip1.FindControl("TextBox1")

 

Response.Write(rad.Text)

 

End Sub

 



1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 07 Jul 2010, 10:58 AM
Hello Paula,

You need to access corresponding RadTab and then use the FindControl() method to get reference to control placed in ItemTemplate.

VB:
 
Dim tab As RadTab = DirectCast(RadTabStrip1.FindTabByText("test"), RadTab) 
Dim rad As TextBox = DirectCast(tab.FindControl("TextBox1"), TextBox) 
Response.Write(rad.Text) 
 


-Shinu.
Tags
TabStrip
Asked by
Paula
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or