0

我正在尝试在我的网页上实现更新面板。当我添加这个时,一切正常:

<script runat="server">
    Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        Me.Label2.Text = Date.Now.ToString
    End Sub
</script>

<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
    <fieldset>
        <asp:Label ID="label1" runat="server" Text="Label"></asp:Label>
        <asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
        <asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>
        <asp:Button ID="Button2" runat="server" Text="Button" />
    </fieldset>
</ContentTemplate>  
</asp:UpdatePanel>

  <asp:TextBox ID="TextBox1" runat="server" Height="289px" TextMode="MultiLine" 
                        Width="663px" ReadOnly="True"></asp:TextBox>

当我尝试对应用程序的 on_load 事件做一些事情时,问题就来了。在后面的代码中,我尝试这样做:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) _
        Handles Me.Load

    If Not IsPostBack Then
    ....a function that produces a very long xml string
        Me.TextBox1.Text ="<f"
    End If
End Sub

这将导致事件不发生。如果我"<"从字符串中更改,一切都很好。为什么"<"我的琴弦里不能有?这很重要,因为我不允许我在文本框中放置一个 xml 字符串。

任何帮助都会很棒!

4

1 回答 1

0

尝试使用&lt<而不是<

于 2012-05-18T22:49:13.640 回答