Share via


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)

Syntax

'Declaration
Public Function RenderSection ( _
    name As String, _
    required As Boolean _
) As HelperResult
'Usage
Dim instance As WebPageBase 
Dim name As String 
Dim required As Boolean 
Dim returnValue As HelperResult 

returnValue = instance.RenderSection(name, _
    required)
public HelperResult RenderSection(
    string name,
    bool required
)
public:
HelperResult^ RenderSection(
    String^ name, 
    bool required
)
member RenderSection : 
        name:string * 
        required:bool -> HelperResult
public function RenderSection(
    name : String, 
    required : boolean
) : HelperResult

Parameters

  • required
    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.

Remarks

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.

See Also

Reference

WebPageBase Class

RenderSection Overload

System.Web.WebPages Namespace