输出页面未正确呈现

时间:2011-12-07 15:57:01

标签: c# asp.net

我创建了一个包含一些控件的页面。当我把“<%label.Text =”改为“;%>”时在Label的定义之后,在执行页面之后不会呈现Label的文本值。为什么呢?

<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 个答案:

答案 0 :(得分:0)

string hello = "hello";

Response.Write( hello );

hello = "world"

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

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