I have an .ascx user control that is in my search.aspx page. How do I grab a control from the .ascx user control in the search.aspx.cs code behind ?
keywordSearch.Value = "value";
// the code behind can't see the keywordSearch control
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.
Normally inner controls are not exposed from templated user controls, because they’re declared as
protected. You can however expose the control in a public property, like this:Edit: If you need to set the value of the control then you’re better off with a property that exposes the value, not the control: