1,在 hy1.aspx.cs中:
public string sname; protected void Page_Load(object sender, EventArgs e)
{
sname = "张三";
}2, 在 hy1.aspx中
<asp:Label ID="Label1" runat="server" Height="45px" Text="<%=sname%>" Width="91px"></asp:Label>不知道,为什么在cs文件中,声明的sname变量,在aspx中,为什么不能显示被赋予的数值呢?非常谢谢大家啊。
public string sname; protected void Page_Load(object sender, EventArgs e)
{
sname = "张三";
}2, 在 hy1.aspx中
<asp:Label ID="Label1" runat="server" Height="45px" Text="<%=sname%>" Width="91px"></asp:Label>不知道,为什么在cs文件中,声明的sname变量,在aspx中,为什么不能显示被赋予的数值呢?非常谢谢大家啊。
这样才可以
试试
{
Label1.Text= "张三";
}