Hello, I recieved strange problem and everything Ive tried to solve it - failed so hope sombody can give me a hand. The problem is that I Can not FindControl("ControlID") when the control is int contentPage. The Code is really simple:
Code:
<%@ Page Language="VB" MasterPageFile="~/Main.master" Title="Untitled Page" %>
<script runat="server">
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Dim myControl1 As Control = me.Page.FindControl("TextBox1")
If (Not myControl1 Is Nothing) Then
' Get control's parent.
Dim myControl2 As Control = myControl1.Parent
TextBox1.Text = "Parent of the text box is : " & myControl2.ID
Else
TextBox1.Text = "Control not found....."
End If
End Sub
</script>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:TextBox ID="TextBox1" runat="server" Width="579px"></asp:TextBox>
</asp:Content>
Any Idea is welcome
Thank YOU