how to get exact format in textbox [multiline]

asp.net Thailand
  • 12 years ago

    how can i get the exact format of the inputted text in textbox [textmode=multiline]. next line is not recognized and is replaced with just a space.

    my idea here is to replace it with <br \>, but i don't know the chr() value of next line. but if there is another workaround, it's fine.

    any advice will be appreciated, thanks.

  • 12 years ago

    Back in my vbscript days I uses to use a code block for getting the newline. But it doesn't work on dot.net lol :-) But I know you can use this.

    Here I have a textbox

    <asp:TextBox ID="TextBox1" runat="server" TextMode="MultiLine"></asp:TextBox>

     And whenever the user is typing text and hits the enter key I can get that and replace it with a <br />

    Label1.Text = TextBox1.Text.Replace(Environment.NewLine, "<br />");

    Hope this helps

  • 12 years ago

    You helped me out again, thanks..

    Yes

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“The difference between theory and practice is smaller in theory than in practice.”