How do I access a c# variable's value in an .aspx page?
asp.net
Solution
It would help if you gave more detail about what you're trying to do, however you can try this:
First make any variables you want to access in your `aspx` markup `protected`.
Then in the page_load method, call `DataBind();`
Then in your markup you can do this:
<%# VariableName %>
The "`<%=`" sequence can only be used within certain contexts in server controls. The sequence "`<%#`" is for DataBound controls and can be used in any context in ASPX page markup. Calling `DataBind();` allows you to use this (almost) anywhere on the page.
Problem
The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>). we need to access the c# variable in .aspx page at the time we have problem Please guide us?