Share via


WebPageBase.RenderSection Method (String)

In layout pages, renders the content of a named section.

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

Syntax

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

returnValue = instance.RenderSection(name)
public HelperResult RenderSection(
    string name
)
public:
HelperResult^ RenderSection(
    String^ name
)
member RenderSection : 
        name:string -> HelperResult
public function RenderSection(
    name : String
) : HelperResult

Parameters

Return Value

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

Exceptions

Exception Condition
HttpException

The name section was already rendered.

-or-

The name section was marked as required but was not found.

Remarks

The RenderSection method assumes that a section passed to it in the name parameter actually exists. If the named section does not exist, the method throws an exception. If you want to use an optional section where the section might exist in an instance of a content page, use the RenderSection method overload to render the section.

See Also

Reference

WebPageBase Class

RenderSection Overload

System.Web.WebPages Namespace