I have the following two pages:
How do I access variables in the code-behind file (Default.aspx.cs) from my embedded code in (Default.aspx) with the <% %>
syntax?
Any public
or protected
(but not private
, the "page" itself inherits from the code-behind Page
class) class-level member can be accessed in this way. For example, if your code-behind class has a property:
protected string SomeValue { get; set; }
Then in your aspx code you can refer to it:
<% =SomeValue %>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With