Hi I have a crontrol on the page:
<asp:TextBox ID="q" runat="server" autocomplete="off" />
which I’m trying to access the value of from the code behind file.
I’ve tried:
TextBox searchTerm = FindControl("q") as TextBox;
But it doesn’t work.
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.
If it is an
ASP.NET TextBox server controlwhich is inside your form, you can simply use theTextpropertyYou can access any elements inside your CodeBehind if it has an
IDproperty with a value andRunatProperty value set to"Server"Ex : You can write some markup like this in your
.ASPXpageand in codebehind