ASP.NET MVC > Views - Razor Engine

Writing text in between C# code block in ASP.NET MVC

How to write content as text in between C# code block in razor view?


Sometimes, Razor markup gets confused between the HTML and C# code. In that case, if we need to force a certain group of characters to mark as HTML syntax then we can wrap those between <text> and </text> like below. 

@using (Html.BeginForm("DisableTwoFactorAuthentication", "Manage", 
FormMethod.Post, new { @class = "form-horizontal", role = "form" }))    
                 {                      
               @Html.AntiForgeryToken() 
              <text> 
               Enabled      
                <input type="submit" value="Disable" class="btn btn-link"/>     
              </text>       
              }
 Views: 18361 | Post Order: 17



Write for us






Hosting Recommendations