ViewViewComponentResult Class¶
A Microsoft.AspNetCore.Mvc.IViewComponentResult
that renders a partial view when executed.
- Namespace
Microsoft.AspNetCore.Mvc.ViewComponents
- Assemblies
- Microsoft.AspNetCore.Mvc.ViewFeatures
Syntax¶
public class ViewViewComponentResult : IViewComponentResult
-
class
Microsoft.AspNetCore.Mvc.ViewComponents.
ViewViewComponentResult
Methods¶
-
Execute
(Microsoft.AspNetCore.Mvc.ViewComponents.ViewComponentContext)¶ Locates and renders a view specified by
Microsoft.AspNetCore.Mvc.ViewComponents.ViewViewComponentResult.ViewName
. IfMicrosoft.AspNetCore.Mvc.ViewComponents.ViewViewComponentResult.ViewName
is <code>null</code>, then the view name searched for is<code>”Default”</code>.Arguments: context (Microsoft.AspNetCore.Mvc.ViewComponents.ViewComponentContext) – The Microsoft.AspNetCore.Mvc.ViewComponents.ViewComponentContext
for the current component execution.public void Execute(ViewComponentContext context)
-
ExecuteAsync
(Microsoft.AspNetCore.Mvc.ViewComponents.ViewComponentContext)¶ Locates and renders a view specified by
Microsoft.AspNetCore.Mvc.ViewComponents.ViewViewComponentResult.ViewName
. IfMicrosoft.AspNetCore.Mvc.ViewComponents.ViewViewComponentResult.ViewName
is <code>null</code>, then the view name searched for is<code>”Default”</code>.Arguments: context (Microsoft.AspNetCore.Mvc.ViewComponents.ViewComponentContext) – The Microsoft.AspNetCore.Mvc.ViewComponents.ViewComponentContext
for the current component execution.Return type: System.Threading.Tasks.Task Returns: A System.Threading.Tasks.Task
which will complete when view rendering is completed.public Task ExecuteAsync(ViewComponentContext context)
-
Properties¶
-
Microsoft.AspNetCore.Mvc.ViewComponents.ViewViewComponentResult.
TempData
¶ Gets or sets the
Microsoft.AspNetCore.Mvc.ViewFeatures.ITempDataDictionary
instance.Return type: Microsoft.AspNetCore.Mvc.ViewFeatures.ITempDataDictionary public ITempDataDictionary TempData { get; set; }
-
Microsoft.AspNetCore.Mvc.ViewComponents.ViewViewComponentResult.
ViewData
¶ Gets or sets the
Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary
.Return type: Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary public ViewDataDictionary ViewData { get; set; }
-
Microsoft.AspNetCore.Mvc.ViewComponents.ViewViewComponentResult.
ViewEngine
¶ Gets or sets the
Microsoft.AspNetCore.Mvc.ViewComponents.ViewViewComponentResult.ViewEngine
.Return type: Microsoft.AspNetCore.Mvc.ViewEngines.IViewEngine public IViewEngine ViewEngine { get; set; }
-
Microsoft.AspNetCore.Mvc.ViewComponents.ViewViewComponentResult.
ViewName
¶ Gets or sets the view name.
Return type: System.String public string ViewName { get; set; }
-