ASCX to aspx

How to get/read a control's value from an ascx page to am aspx page?
Who is Participating?
In general, use FindControl method.

 foreach (Control c in form1.Controls)
            if (c.GetType ( ).Name.ToLower ( ) == "webusercontrol_ascx")
                UserControl uc = (UserControl)c;

                txt = (TextBox)uc.FindControl ( "txtTitle" );

Open in new window

Ryan ChongCommented:
yes, use FindControl method as OMC2000 suggested.

you can read further article below when necessary:

ASP.NET Web Form User Control's Basic Interaction's-Basic-Interaction.html
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.