ASCX to aspx

How to get/read a control's value from an ascx page to am aspx page?
zachvaldezAsked:
Who is Participating?
 
OMC2000Commented:
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

0
 
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
https://www.experts-exchange.com/articles/31726/ASP-NET-Web-Form-User-Control's-Basic-Interaction.html
0
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.