MVC3, how can I set html target in controller and render it as the normal target in the View page.

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
<p style="border-style:initial; border-color:initial; font-family:Segoe UI,Lucida Grande,Verdana,Arial,Helvetica,sans-serif; outline-style:initial; outline-color:initial; padding-right:0px; border-right-style:none; border-bottom-style:none; border-left-style:none; border-width:initial; border-color:initial; list-style-type:none; color:#333333; font-size:13px; line-height:16px; text-align:left
for example
<p style="border-style:initial; border-color:initial; font-family:Segoe UI,Lucida Grande,Verdana,Arial,Helvetica,sans-serif; outline-style:initial; outline-color:initial; padding-right:0px; border-right-style:none; border-bottom-style:none; border-left-style:none; border-width:initial; border-color:initial; list-style-type:none; color:#333333; font-size:13px; line-height:16px; text-align:left
I set <strong style="border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; font-weight:bold; font-style:inherit; font-family:inherit; margin-bottom:0px; outline-style:initial; outline-color:initial; padding-bottom:0px <span style="border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; font-weight:inherit; font-style:inherit; font-family:inherit; margin-bottom:0px; outline-style:initial; outline-color:initial; padding-bottom:0px ViewModel.newControl
= " test "; in controller, and use <strong style="border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; font-weight:bold; font-style:inherit; font-family:inherit; margin-bottom:0px; outline-style:initial; outline-color:initial; padding-bottom:0px <span style="border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; font-weight:inherit; font-style:inherit; font-family:inherit; margin-bottom:0px; outline-style:initial; outline-color:initial; padding-bottom:0px View.newControl to
get it at View page. but it will render as test (Be encoded as <span style="border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; font-style:inherit; font-family:arial; margin-bottom:0px; outline-style:initial; outline-color:initial; padding-bottom:0px &lt;p&gt;test&lt;/p&gt;),
not the actual html target I want.
<p style="border-style:initial; border-color:initial; font-family:Segoe UI,Lucida Grande,Verdana,Arial,Helvetica,sans-serif; outline-style:initial; outline-color:initial; padding-right:0px; border-right-style:none; border-bottom-style:none; border-left-style:none; border-width:initial; border-color:initial; list-style-type:none; color:#333333; font-size:13px; line-height:16px; text-align:left
it works under mvc 2, it there a new way to achieve it in MVC 3?
<p style="border-style:initial; border-color:initial; font-family:Segoe UI,Lucida Grande,Verdana,Arial,Helvetica,sans-serif; outline-style:initial; outline-color:initial; padding-right:0px; border-right-style:none; border-bottom-style:none; border-left-style:none; border-width:initial; border-color:initial; list-style-type:none; color:#333333; font-size:13px; line-height:16px; text-align:left
for some reasons, I must set the html code in controller. So can not use the html target in View page directly.
<p style="border-style:initial; border-color:initial; font-family:Segoe UI,Lucida Grande,Verdana,Arial,Helvetica,sans-serif; outline-style:initial; outline-color:initial; padding-right:0px; border-right-style:none; border-bottom-style:none; border-left-style:none; border-width:initial; border-color:initial; list-style-type:none; color:#333333; font-size:13px; line-height:16px; text-align:left
regards

View the full article
 
Back
Top