Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

203
Views
Using DataTables, I'm grabbing HTML strings from an API, but the table cell is displaying "<p>Hello</p>" instead of just "Hello" in a p tag. What do?

I have tried encoding the HTML in my API, but then it just displays "<p>Hello" etc in the cell. I've also tried different variations of Html.Raw and HttpUtility.HtmlDecode in the columns section of the DataTables initializer but it's possible I'm using those incorrectly. I am open to stripping HTML with replace functions if necessary (though keeping the paragraph breaks at least would be ideal), but I have used DataTables to manually render anchor tags in the cell so I don't understand how this is different. How do I tell DataTables "this is not a string, it is HTML and you should render it as such?"

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Finally figured it out. Didn't realize some of the data I had was already encoded, so I had to decode the affected fields before creating the JSON with them. Attempting to decode in the datatables initialization did not work. I used HttpUtility.HtmlDecode(fieldName) in the API Controller, created the JSON using the decoded items, then everything worked as expected. Hope this helps someone someday.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!