Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

204
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda