FindControl problem

Discussion in 'ASP .Net' started by Jaime, May 20, 2005.

  1. Jaime

    Jaime Guest

    Hi all,

    I'm going crazy trying to sort out the correct way to find a contol, here's
    the scenario:

    I have a web form WebForm1 that contains a user control 'UC1'... now the UC1
    has another user control called 'CalendarCtl' and the following structure
    inside

    <asp:panel id="panel1">
    <asp:table id="table1">
    <asp:tablerow>
    <asp:tablecell>
    <jdp:popUpCalendar>
    <asp:textbox id="date">
    <asp:ImageButton id="openCalendarPopUp">
    ....

    now when I click the ImageButton, the calendar control opens fine and works
    ok, but on the OnSelectionChanged handler of the CalendarCtl user control, I
    can't sort out the correct way to get the instance of the textbox control
    with ID="date" in the parent user control...

    I've tried:

    string boxName; // this contains the ClientID of the TextBox control in UC1

    TextBox box = (TextBox) Page.FindControl( boxName ); // nothing... box =
    null

    HtmlForm form = (TextBox) Page.FindControl( "Form1" );
    Panel pnl = (Panel) form.FindControl( "panel1"); // now this one does
    not find the panel
    Table tbl = (Table) ...
    TableRow row = ...
    TableCell cell = ...
    TextBox box = ...

    I can't figure what control to ask for the 'date' TextBox...

    Any ideas?

    J
     
    Jaime, May 20, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?dHBhcmtzNjk=?=

    ItemCreated FindControl problem c#

    =?Utf-8?B?dHBhcmtzNjk=?=, Jun 16, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    6,519
    =?Utf-8?B?QkVMSVVT?=
    Jun 16, 2005
  2. Arjen

    Findcontrol problem

    Arjen, Oct 17, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    2,043
    Scott Allen
    Oct 18, 2005
  3. ThunderMusic
    Replies:
    2
    Views:
    421
    ThunderMusic
    Oct 9, 2006
  4. Terry

    problem with FindControl

    Terry, Feb 15, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    591
    Terry
    Feb 15, 2007
  5. Patrice

    Re: Findcontrol problem

    Patrice, Jul 16, 2007, in forum: ASP .Net
    Replies:
    0
    Views:
    382
    Patrice
    Jul 16, 2007
Loading...

Share This Page