Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Nov 28, 2012 01:37 PM by Coreyg1
Member
1 Points
6 Posts
Nov 27, 2012 09:33 PM|LINK
I have a request to display text on a view:
"added <location_group_id> element to the <BusinessListing> to indicate listings with multiple related locations."
However, <location_group_id> and <BusinessListing> are interpreted as markup tags. Therefore only this is displayed:
"the element to the to indicate listings with multiple related locations."
I've tried <text></text> and @:
Star
12320 Points
2270 Posts
Nov 27, 2012 10:09 PM|LINK
Try HttpContext.Current.Server.HtmlEncode(yourText). This will convert angle brackets into < and >
http://msdn.microsoft.com/en-us/library/w3te6wfz.aspx
All-Star
135023 Points
21648 Posts
Moderator
MVP
Nov 28, 2012 03:03 AM|LINK
Coreyg1 I've tried <text></text> and @:
@Html.Raw
Nov 28, 2012 01:09 PM|LINK
Sorry, I forgot to mention that I tried HTML.RAW which produces the exact same result.
Nov 28, 2012 01:12 PM|LINK
Unfortunately you are too correct. It does convert the < > to < and >.
The simple solution is for me to a spaces such as "< location_group_id >" but it's not ideal.
7983 Points
2099 Posts
Nov 28, 2012 01:17 PM|LINK
http://forums.asp.net/t/1295681.aspx/1
http://stackoverflow.com/questions/4301729/asp-net-mvc-how-to-display-html-tags-as-html
Nov 28, 2012 01:37 PM|LINK
Sorry the <code> tags didn't work. I tried a few other suggestion found in those two links but had no luck.
I accidentally found the answer though, I used
@("<location_group_id>")
Coreyg1
Member
1 Points
6 Posts
Display markup as text
Nov 27, 2012 09:33 PM|LINK
I have a request to display text on a view:
"added <location_group_id> element to the <BusinessListing> to indicate listings with multiple related locations."
However, <location_group_id> and <BusinessListing> are interpreted as markup tags. Therefore only this is displayed:
"the element to the to indicate listings with multiple related locations."
I've tried <text></text> and @:
AceCorban
Star
12320 Points
2270 Posts
Re: Display markup as text
Nov 27, 2012 10:09 PM|LINK
Try HttpContext.Current.Server.HtmlEncode(yourText). This will convert angle brackets into < and >
http://msdn.microsoft.com/en-us/library/w3te6wfz.aspx
ignatandrei
All-Star
135023 Points
21648 Posts
Moderator
MVP
Re: Display markup as text
Nov 28, 2012 03:03 AM|LINK
@Html.Raw
Coreyg1
Member
1 Points
6 Posts
Re: Display markup as text
Nov 28, 2012 01:09 PM|LINK
Sorry, I forgot to mention that I tried HTML.RAW which produces the exact same result.
Coreyg1
Member
1 Points
6 Posts
Re: Display markup as text
Nov 28, 2012 01:12 PM|LINK
Unfortunately you are too correct. It does convert the < > to < and >.
The simple solution is for me to a spaces such as "< location_group_id >" but it's not ideal.
RameshRajend...
Star
7983 Points
2099 Posts
Re: Display markup as text
Nov 28, 2012 01:17 PM|LINK
http://forums.asp.net/t/1295681.aspx/1
http://stackoverflow.com/questions/4301729/asp-net-mvc-how-to-display-html-tags-as-html
Coreyg1
Member
1 Points
6 Posts
Re: Display markup as text
Nov 28, 2012 01:37 PM|LINK
Sorry the <code> tags didn't work. I tried a few other suggestion found in those two links but had no luck.
I accidentally found the answer though, I used
@("<location_group_id>")