Hi friends ,
In your web application, some times you need to display multi-line formatted text in your txtBox. For example, the string value in your database table is -"r 001,<br/>solved<br/>" , and you have to display that value in your text as follows is the requirement-
r001,
solve
thanks
So you have to replace all the <br/> tags with new line in your database value on the time of retrieving, for that the following method will fulfill the above requirement.
- public string ReplaceBRwithNewline(string txtVal)
- {
- string newText = "";
-
- System.Text.RegularExpressions.Regex regex =
- new System.Text.RegularExpressions.Regex(@"(<br />|<br/>|</ br>|</br>)");
-
- newText = regex.Replace(txtVal, "\r\n");
-
- return newText;
- }
Please give your valuable suggestions and feedback.