How do I access a c# variable's value in an .aspx page?

后端 未结 4 1343
春和景丽
春和景丽 2021-01-02 18:38

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

4条回答
  •  借酒劲吻你
    2021-01-02 19:00

    Declare C# code behind variable either public or protected and then us it in <% %> block. e.g. <%= strMyCodebehindvariable%> or <%# strMyCodebehindvariable%>. If you are using second option then you must call DataBind() method in page load.

提交回复
热议问题