Q. Sections work only in views, not in partials. An editor template is a special kind of partial. It's bad practice to put javascript in partials anyway, so I would simply declare the section in the
Edit.cshtml
view.
But if you very much insist on putting your scripts in the middle of your markup, since Razor doesn't support sections in partials, you could implement custom helpers to achieve that.
REF: http://stackoverflow.com/questions/10810446/rendersection-and-editorformodel-in-asp-net-mvc
沒有留言:
張貼留言