2011-12-07 105 views
0

我创建了一个页面,其上有一些控件。当我在标签的定义之后放置“<%label.Text =”changed“;%>”时,标签的文本值在页面执行后不呈现。为什么?输出页面显示不正确

<div> 
    <tagprefix:MD ID="CC" runat="server" /> 
     <asp:TextBox runat="server" ID="TextBox1"/> 
     <asp:Button Text="button" ID="Button" runat="server" onclick="Button_Click" /> 
     <%= "Hello..." %> 

     <% label.Text = "changed"; %>       //working fine 
     <asp:Label ID="label" Text="text" runat="server" /> 
     <% label.Text = "changed"; %>    // do not work 
</div> 

回答

1
string hello = "hello"; 

Response.Write(hello); 

hello = "world" 

它为什么会显示 “你好”,而不是 “世界”?

这个问题的答案也是你的答案。