WebPageBase.RenderSection Method (String, Boolean)

In layout pages, renders the content of a named section and specifies whether the section is required.

Namespace:  System.Web.WebPages
Assembly:  System.Web.WebPages (in System.Web.WebPages.dll)

public HelperResult RenderSection(
	string name,
	bool required


Type: System.String
The section to render.
Type: System.Boolean
true to specify that the section is required; otherwise, false.

Return Value

Type: System.Web.WebPages.HelperResult
The HTML content to render.

Use the RenderSection method overload when you want to render optional content sections in a layout page. For example, if a user of your website lives in a certain region, the code on a content page could add a section that displays special pricing packages for that region. To specify that a section is optional and should only be rendered if it exists, pass false to the required parameter.