I have an MVC3 C#.Net web app. I am looping through a DataTable. Some rows are importing OK, some are not. I am wanting to send a list of errors back to the view in a list format. I am assigning the following text to a ViewBag property
Input error on Row(1) Cell(3) Input string was not in a correct format.<br/> Input error on Row(4) Cell(3) Input string was not in a correct format.<br/>
I was hoping the br would write a line break in the HTML. It does not. I want the error message to look like this
Input error on Row(1) Cell(3) Input string was not in a correct format.
Input error on Row(4) Cell(3) Input string was not in a correct format.
Any ideas?
When you throw into your view, use
@Html.Raw(ViewBag.Test)
instead of
@ViewBag.Test
That will signify to the compiler that string is html and does not need to be encoded as such.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With