accessing a code behind variable from aspx
Posted on 2006-07-20
hi experts, the below is trivial but it is driving me nuts!
for simplicity i am addressing my problem like this, i am doing the following code in the code behind:
public string x = "L";
private void Page_Load(object sender, System.EventArgs e)
x = "ss";
x = "ddd";
and am trying to access variable x from the aspx like this:
<td><%# x %></td>
my actual goal is to have more complex coding but have reduced my approach to first accessing x in its simples form. just that i haev tried this on 2 different webforms now and am getting an empty string. on other webforms i have used far more complex similar functionality and either i am missing some webform setting or else some magic is determining that this does not work, the end result is that i am going crazy. your help would be apprecaited. 10x a lot.