How do i add a New Line "\\n"
in the text box I had created in asp.net web site. For instance
TextBoxA.Text="Hello";
TextBoxB.Text="World";
TextBoxC="Hello
World"
Like:
TextBoxC.Text=TextBoxA.Text+"\n"(or something)+TextBoxB.Text;
TextBoxC.Text= string.Format("{0}\n{1}", TextBoxA.Text,TextBoxB.Text);
or
TextBoxC.Text= TextBoxA.Text + "\n" + TextBoxB.Text;
Now, for this to work you have to make the textbox multiline...
<asp:TextBox ID="TextBoxC" runat="server" TextMode="MutiLine" />
You need to use texmode of your textbox.
Add TextMode to multiline.
<asp:TextBox runat="server" ID="MyBox" TextMode="MultiLine" Rows="10" />
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.