これについても同様のスレッドがあります。しかし、自動幅の複数行 TextBox が必要です(幅をより大きな行に合わせる)。
このコードを使用すると、複数行の TextBox (自動高さ) を使用できます
<div style="float:left; white-space:nowrap ">
<asp:TextBox style="display:inline; overflow:hidden"
ID="txt1"
runat="server"
Wrap="false"
ReadOnly="true"
TextMode="MultiLine"
BorderStyle="none"
BorderWidth="0">
</asp:TextBox>
</div>
<div style="float:left">
<asp:TextBox ID="txt2" runat="server" Text="Example textbox"></asp:TextBox>
</div>
コードビハインド:
txt1.Rows= text.Split("|").Length ' Sets number of rows but with low performance
txt1.Text = text.Replace("|", Environment.NewLine)
もう一度、あなたの助けに感謝します。