I have the following two pages:
- Default.aspx
- Default.aspx.cs
How do I access variables in the code-behind file (Default.aspx.cs) from my embedded code in (Default.aspx) with the <% %> syntax?
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.
Any
publicorprotected(but notprivate, the “page” itself inherits from the code-behindPageclass) class-level member can be accessed in this way. For example, if your code-behind class has a property:Then in your aspx code you can refer to it: