I have a UserControl on my aspx file. On the main page I have a button. When Click on the button, I want to alert the UserControl’s Textbox value. Is it possible?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You need to expose the UserControl’s TextBox from the UserControl. Like this:
In this way, the TextBox becomes a public property of the UserControl, and it is accessible to any page using it. You can access to it from Javascript in the following way:
Where
MyTextBox1would be the name (ID) of the UserControl, andtxtBoxthe name of the property.Good luck!