RazorPage.RenderSectionAsync Method

Definition

Overloads

RenderSectionAsync(String)

In layout pages, asynchronously renders the content of the section named name.

RenderSectionAsync(String, Boolean)

In layout pages, asynchronously renders the content of the section named name.

RenderSectionAsync(String)

Source:
RazorPage.cs
Source:
RazorPage.cs

In layout pages, asynchronously renders the content of the section named name.

public:
 System::Threading::Tasks::Task<Microsoft::AspNetCore::Html::HtmlString ^> ^ RenderSectionAsync(System::String ^ name);
public System.Threading.Tasks.Task<Microsoft.AspNetCore.Html.HtmlString> RenderSectionAsync (string name);
public System.Threading.Tasks.Task<Microsoft.AspNetCore.Html.HtmlString?> RenderSectionAsync (string name);
member this.RenderSectionAsync : string -> System.Threading.Tasks.Task<Microsoft.AspNetCore.Html.HtmlString>
Public Function RenderSectionAsync (name As String) As Task(Of HtmlString)

Parameters

name
String

The section to render.

Returns

A Task<TResult> that on completion returns an empty IHtmlContent.

Remarks

The method writes to the Output and the value returned is a token value that allows the Write (produced due to @RenderSection(..)) to succeed. However the value does not represent the rendered content.

Applies to

RenderSectionAsync(String, Boolean)

Source:
RazorPage.cs
Source:
RazorPage.cs

In layout pages, asynchronously renders the content of the section named name.

public:
 System::Threading::Tasks::Task<Microsoft::AspNetCore::Html::HtmlString ^> ^ RenderSectionAsync(System::String ^ name, bool required);
public System.Threading.Tasks.Task<Microsoft.AspNetCore.Html.HtmlString> RenderSectionAsync (string name, bool required);
public System.Threading.Tasks.Task<Microsoft.AspNetCore.Html.HtmlString?> RenderSectionAsync (string name, bool required);
member this.RenderSectionAsync : string * bool -> System.Threading.Tasks.Task<Microsoft.AspNetCore.Html.HtmlString>
Public Function RenderSectionAsync (name As String, required As Boolean) As Task(Of HtmlString)

Parameters

name
String

The section to render.

required
Boolean

Indicates the name section must be registered (using @section) in the page.

Returns

A Task<TResult> that on completion returns an empty IHtmlContent.

Exceptions

if required is true and the section was not registered using the @section in the Razor page.

Remarks

The method writes to the Output and the value returned is a token value that allows the Write (produced due to @RenderSection(..)) to succeed. However the value does not represent the rendered content.

Applies to