View Single Post
Old June 16th, 2006, 09:59 AM
Aaron Edwards Aaron Edwards is offline
Friend of Wrox
Join Date: Apr 2004
Location: San Francisco, CA, USA.
Posts: 204
Thanks: 0
Thanked 0 Times in 0 Posts
Default Accessing the Controls of a User Control?

Is it possible to Access the controls inside a User Control from the main page?

I've tried this, and it doesn't seem to work:

(Main Page-codebehind)

Dim tbCCNumber As TextBox = CType(Me.PaymentPanel1.FindControl("tbCCNumber"), TextBox)

In this case, PaymentPanel1 is an instance of a User Control called PaymentPanel, which I've referenced on the main page as follows:

<%@Reference Control="~/PaymentPanel.ascx" %>

Do I need to expose the constituent controls on the user control as properties or something like that?