ASP.NET MVC: Custom Html Helpers in Razor

You can call your helper like this:

@{ Html.IncrementalMenu(MenuBlock.Site); }

WebForms syntax

<% Html.IncrementalMenu(MenuBlock.Site); %>

You just call your method, and the return value (if there is any) is ignored.

Code like this expects a return value, and writes the return value to the html stream:

@Html.YourHelper()

Webforms syntax:

<%: Html.YourHelper() %>

The same, if result value != IHtmlString:

<%= Server.HtmlEncode(Html.YourHelper()) %>

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)