lundi 28 décembre 2015

ASP.NET HTML Encoded Data-Bind and br tag

I'm trying to encode data that is to be displayed on a separate page (.aspx) after a user submits a form with their information and questions. There are both text input and textarea fields that the user can fill out.

I'm using the <%#: %> expression to place this data on the page since it does the HTML encoding, but have run into an issue with the encoding also encoding the br tags as text instead of actual line breaks.

Is there a way to make it so that the br tags still cause a line break, but leave everything else encoded using this method?

Example of user input:

Hi

This is what should be responded with.

Here is an example of the code that places it on the page:

<p><%#: ((DiscussionThread.Discussion)Container.DataItem).Text %></p>

What it currently displays on the page:

Hi<br /><br />This is what should be responded with.

Thanks in advanced!




Aucun commentaire:

Enregistrer un commentaire