Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 15th, 2006, 07:00 AM
Authorized User
 
Join Date: Mar 2006
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to kalchev
Default Can not FindControl("ControlID") when the control

 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
 
Old April 15th, 2006, 07:09 AM
Authorized User
 
Join Date: Mar 2006
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to kalchev
Default

I've soleved it but it when it is with textbox
it works when it is like:
Master.Findecontrol.....

But when it is imageButton it doesn't
Any Idea:)





Similar Threads
Thread Thread Starter Forum Replies Last Post
FindControl in DataListItem SKhna ASP.NET 2.0 Basics 1 February 29th, 2008 05:15 PM
FindControl Wervis C# 7 November 30th, 2005 09:51 AM
FindControl dkr72 Excel VBA 0 January 19th, 2005 09:55 AM
Problem with FindControl RussC Excel VBA 1 June 16th, 2004 11:58 AM
FindControl Method problem jbenson001 ASP.NET 1.x and 2.0 Application Design 3 March 8th, 2004 10:32 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.