AllExperts > Experts 
Search      

Active Server Pages Programming (ASP)

Volunteer
Answers to thousands of questions
 Home · More Questions · Answer Library  · Encyclopedia ·
More Active Server Pages Programming (ASP) Answers
Question Library

Ask a question about Active Server Pages Programming (ASP)
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Srini Nagarajan
Expertise
I can answer any kind of questions in ASP.NET, C#, VB.NET, SharePoint 2007, ASP, Coldfusion, Powerbuilder 7.00 / 8.00, JAVA servlets, MS SQL 2000 / MSSQL7, Sybase

Experience
Contact me if you need any custom development on ASP.NET, ASP, SharePoint 2007, Coldfusion, Powerbuilder.
 
   

You are here:  Experts > Computing/Technology > Business Software > Active Server Pages Programming (ASP) > convert "\n" to <BR>

Topic: Active Server Pages Programming (ASP)



Expert: Srini Nagarajan
Date: 8/15/2005
Subject: convert "\n" to <BR>

Question
I have an ASP textbox on my homepage: <asp:textbox id="txtBody" runat="server" TextMode="MultiLine" Columns="40" Rows="10" />.  For large, decriptive text messages, how would I convert a carriage return (like "\n" or vbCrLf) to <br> for an HTML emailer?

If it helps, I am writing this in C#. What would I search for in the textbox? What tools are available in ASP to search this field?

Thanks,
Joe

Answer
Hi

Can you use a Rich Text Editor Tool? User can edit and see the result and it saves as a HTML tags no converstion required

If you need a replace use this function

public static String Replace(String strText,String strFind,String
strReplace)
 {
   int iPos=strText.IndexOf(strFind);
   String strReturn="";
   while(iPos!=-1)
   {
     strReturn+=strText.Substring(0,iPos) + strReplace;
     strText=strText.Substring(iPos+strFind.Length);
     iPos=strText.IndexOf(strFind);
   }
   if(strText.Length>0)
     strReturn+=strText;
   return strReturn;
 }
}

Happy Programming!

-Srini

Add to this Answer    Ask a Question



  Rate this Answer
   Was this answer helpful?
Not at allDefinitely              
   12345  

     
About Us | Advertise on This Site | User Agreement | Privacy Policy | Help
Copyright  © 2008 About, Inc. About and About.com are registered trademarks of About, Inc. The About logo is a trademark of About, Inc. All rights reserved.