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>       
              }

No comments:

Post a Comment

How to register multiple implementations of the same interface in Asp.Net Core?

 Problem: I have services that are derived from the same interface. public interface IService { } public class ServiceA : IService { ...