Nitin Kumar
Nitin Kumar

Reputation: 908

Unable To Show Multiline Textbox text with new line in Label

If i enter below text in my multi line textbox

Nitin
Kumar
Shukla

then i got this result

Nitin Kumar Shukla

but i want result same as i write in my multi line textbox

Here is my aspx page code

<asp:TextBox ID="ttt" TextMode="MultiLine" runat="server"></asp:TextBox>
   <asp:Button ID="btn" runat="server" Text="hjhj" onclick="btn_Click" />
   <asp:Label ID="lll" runat="server"></asp:Label>

here is my cs page code

protected void btn_Click(object sender, EventArgs e)
    {
        lll.Text = ttt.Text;
    }

Upvotes: 1

Views: 366

Answers (1)

Ankit
Ankit

Reputation: 207

try this

lll.Text = ttt.Text.Replace(Environment.NewLine, "<br />");

Upvotes: 3

Related Questions