Friday, 15 July 2011

asp.net mvc - MVC Razor Html helper -



asp.net mvc - MVC Razor Html helper -

in asp.net mvc 4, want create html extend method.

i want work this:

in razor view:

<button type='button' click='domethod'>click</button> @helper.minify( <script> function domethod() { alert('i'm script!'); } </script> );

i think how can create render:

<button type='button' click='domethod'>click</button> <script>function domethod() {alert('i'm script!');}</script>

may create extend in backcode, can recevie <script tag> ?

you can utilize extensions:

public static class extensions { public static mvchtmlstring test(this htmlhelper html, string expression) { homecoming new mvchtmlstring("data"); } } @html.test("my test")

asp.net-mvc razor model-view-controller

No comments:

Post a Comment