Class ControlExtension

Extension methods to the Control class, needed by the auto save function.

Inheritance
System.Object
ControlExtension
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.Web
Assembly: EPiServer.dll
Version: 8.11.0
Syntax
public static class ControlExtension

Methods

ApplyEditAttributes(Control, String)

Applies the attributes needed to make the content of this control editable.

Declaration
public static void ApplyEditAttributes(this Control control, string propertyName)
Parameters
Type Name Description
System.Web.UI.Control control

The object this method extends.

System.String propertyName

Name of the property that this editable control should be connected to.

ApplyEditAttributes<TContentData>(Control, Expression<Func<TContentData, Object>>)

Applies the attributes needed to make the content of this control editable.

Declaration
public static void ApplyEditAttributes<TContentData>(this Control control, Expression<Func<TContentData, object>> propertyNameExpression)
Parameters
Type Name Description
System.Web.UI.Control control

The object this method extends.

System.Linq.Expressions.Expression<System.Func<TContentData, System.Object>> propertyNameExpression

An expresion indicationg the property name. Must be a MemberExpression or a UnaryExpression.

Type Parameters
Name Description
TContentData

The type of the content data.

FindControl<T>(Control)

Finds the first control of the requested type.

Declaration
public static T FindControl<T>(this Control control)

    where T : Control
Parameters
Type Name Description
System.Web.UI.Control control

The object this method extends.

Returns
Type Description
T

A typed control

Type Parameters
Name Description
T

A type of control

FindControl<T>(Control, Int32)

Finds control number n of the requested type.

Declaration
public static T FindControl<T>(this Control control, int index)

    where T : Control
Parameters
Type Name Description
System.Web.UI.Control control

The object this method extends.

System.Int32 index

The index of that control. Used to identify which control to return on a page that has several controls of the request type.

Returns
Type Description
T

A typed control

Type Parameters
Name Description
T

A type of control

FindControl<T>(Control, String)

Finds the first control of the requested type and the requested id.

Declaration
public static T FindControl<T>(this Control control, string id)

    where T : Control
Parameters
Type Name Description
System.Web.UI.Control control

The object this method extends.

System.String id

The id of the control to find.

Returns
Type Description
T

A typed control

Type Parameters
Name Description
T

A type of control

FindControl<T>(Control, String, Int32)

Finds control number n of the requested type that has a specific id.

Declaration
public static T FindControl<T>(this Control control, string id, int index)

    where T : Control
Parameters
Type Name Description
System.Web.UI.Control control

The object this method extends.

System.String id

The id of the control to find.

System.Int32 index

The index of that control. Used to identify which control to return on a page that has several controls of the request type.

Returns
Type Description
T

A typed control

Type Parameters
Name Description
T

A type of control