Click here to Skip to main content
15,893,588 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
Hi Friends,
Please share the equivalent tag of asp literal in mvc except the (@Html.Raw()).Because I have tried the raw function but it is not working fine for me.In my project I want to use the equivalent literal tag in mvc.Please suggest some solutions which help me to learn about the equivalent tag of asp literal.
Posted
Comments
Nick Ginis 18-Jun-14 0:58am    
What do you intend to use it for?
SRS(The Coder) 18-Jun-14 0:59am    
The asp:Litera is the normal inner text for the HTML element within which you are putting this control. So this is not any specific html element in MVC.

Please let me know if anything else you want.

1 solution

You may try something as shown below.

ViewModel

C#
public class YourViewModel
{
  public string YourLiteralContent {get;set;}
}


Controller's Action Method

SQL
public ActionResult YourPage()
{
  return View(new YourViewModel {YourLiteralContent = YourOldLiteralContent});
}


View

<div>
  Your Literal Control's content here:
  @Model.YourLiteralContent
</div>


I hope this will help to you.Good Luck :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900