0

Web ページに更新パネルを実装しようとしています。これを追加すると、すべて正常に動作します:

<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 に答える