0

I am writing an ASP.NET MVC application. I have a page that renders a table with a foreach statement.

One of the lines is a text I want to split in different <BR> depending on the content

I want to split in each ; I have.. So I am using

@foreach (var model in Model.pagins) { <td> @Html.Raw(Html.Encode(model.Description).Replace(";", "<br />"))</td> } 

When the text is like this "aaa;bbb;ccc;ddd" it works fine. It shows

 aaa <br> bbb <br> ccc <br> ddd 

But when the text has a "+" it also split the "+". If I have "a+aa;bb+b;ccc;ddd" . It shows

 a+ <br> aa <br> bb+ <br> b <br> ccc <br> ddd 

Why this is happening? How can I split it without this problem?

Thanks

1
  • 2
    Cannot reproduce your issue in my local side. If you replace model.Description with "a+aa;bb+b;ccc;ddd", do you still get the same issue? Note that I am using ASP.NET MVC (.Net Framework 4.7.2).
    – Yong Shun
    CommentedDec 25, 2024 at 2:06

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.