Home Rendering Quotation Marks in a @Html.Raw() Syntax
Reply: 2

Rendering Quotation Marks in a @Html.Raw() Syntax

Emre Sevim
1#
Emre Sevim Published in 2018-01-12 23:11:27Z

Trying to render this syntax in a Partial View:

 @Html.Raw("<table class="table table-togglable table-hover default footable-loaded footable">") 

..but quotation marks inside html sentence are producing problem. I tried as far:

 @Html.Raw("<table class=")
 @Html.Raw("&quot;")
 @Html.Raw("table table-togglable table-hover default footable-loaded footable")
 @Html.Raw("&quot;")
 @Html.Raw(">")

the result is deplorable indeed.

Adam Brown
2#
Adam Brown Reply to 2018-01-12 23:15:39Z

You need to escape the quote characters in C#, not in html. So you'd need to do this:

@Html.Raw("<table class=\"table table-togglable table-hover.... ");

In other words, put a backslash \ character before every quote you want to appear in the output.

SoronelHaetir
3#
SoronelHaetir Reply to 2018-01-12 23:15:53Z

Use the &jquot; and ' entities, They will get translated to the characters for display.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.316626 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO