New to Telerik UI for ASP.NET Core? Start a free 30-day trial

Extension methods for ViewContext.

Definition

Namespace:Kendo.Mvc.Extensions

Assembly:Kendo.Mvc.dll

Syntax:

C#
public static class ViewContextExtensions

Inheritance: objectViewContextExtensions

Inherited Members object.GetType()object.MemberwiseClone()object.ToString()object.Equals(object)object.Equals(object, object)object.ReferenceEquals(object, object)object.GetHashCode()...

Methods

Creates an HtmlHelper instance for the specified model type.

C#
public static HtmlHelper<T> CreateHtmlHelper<T>(this ViewContext viewContext)
Parameters:viewContextViewContext

The view context.

Returns:

HtmlHelper<T>

An HtmlHelper instance for the specified type.

Gets the full HTML field name for the given field name within the current template context.

C#
public static string GetFullHtmlFieldName(this ViewContext viewContext, string name)
Parameters:viewContextViewContext

The view context.

namestring

The field name.

Returns:

string

The full HTML field name.

Gets a service of the specified type from the HTTP context.

C#
public static T GetService<T>(this HttpContext context)
Parameters:contextHttpContext

The HTTP context.

Returns:

T

The service instance.

Gets a service of the specified type from the ViewContext's HTTP context.

C#
public static T GetService<T>(this ViewContext viewContext)
Parameters:viewContextViewContext

The view context.

Returns:

T

The service instance.

Creates a ViewContext for a specific model type.

C#
public static ViewContext ViewContextForType<T>(this ViewContext viewContext, IModelMetadataProvider metadataProvider)
Parameters:viewContextViewContext

The source view context.

metadataProviderIModelMetadataProvider

The model metadata provider.

Returns:

ViewContext

A new ViewContext configured for the specified type.