A
section allows you to add something in a view which will be added in the layout. ie:-
view
@section scripts {
<script>
alert('foo');
</script>
}
layout
@RenderSection("scripts", false)
now this named
section scripts will be rendered where you have specified in the layout.@RenderSection also has 2 signatures:-public HelperResult RenderSection(string name) // section required in the view
public HelperResult RenderSection(string name, bool required)
No comments:
Post a Comment