<%= ...some text ... %> : contains an expression. The result of this expression will be a call to .ToString() , and the resulting string will be output directly.
<%: ...some text ... %> : contains an expression. If the result of the expression is IHtmlString , .ToHtmlString() will be called on it, and the results will be output directly. Otherwise, the result of this expression will have .ToString() called on it, and the resulting string will be escaped before exiting.
<@ ...some text ... %> : contains the page directive for objects such as namespaces that should be included. This is a compiler directive and is evaluated when compiling a view (usually the first time a view is called).
<% ...some text ... %> : contains one or more operators. These instructions are followed.
<%# ...some text ... %> : This is a data binding expression in ASP.NET WebForms. I do not think this is the correct syntax for MVC View. However, you continue to mention “user controls” that are not really part of the MVC paradigm, so you may need to reconsider whether this question really relates to MVC.
source share