FindControl problem

J

Jaime

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top