Class SetFocusEvent

This event is used to give a control focus and/or select the controls text content.

Inheritance
System.Object
SetFocusEvent
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.ClientScript.Events
Assembly: EPiServer.dll
Version: 8.11.0
Syntax
public class SetFocusEvent : EventBase
Remarks

Default behaviour is to give focus to the control but not select its text content.

Constructors

SetFocusEvent(EventType, String)

Creates a new focus event. When the event is run the element will be focused.

Declaration
public SetFocusEvent(EventType eventType, string controlId)
Parameters
Type Name Description
EventType eventType

The client side event when the focus occurs

System.String controlId

Client side id of the control to focus

SetFocusEvent(EventType, String, Boolean, Boolean)

Initializes a new instance of the SetFocusEvent class.

Declaration
public SetFocusEvent(EventType eventType, string controlId, bool focus, bool select)
Parameters
Type Name Description
EventType eventType

The client side event when the focus occurs

System.String controlId

Client side id of the control to focus

System.Boolean focus

if set to true the control will be focused

System.Boolean select

if set to true the control text will be selected

SetFocusEvent(EventType, Control)

Creates a new focus event. When the event is run the element will be focused.

Declaration
public SetFocusEvent(EventType eventType, Control control)
Parameters
Type Name Description
EventType eventType

The client side event when the focus occurs

System.Web.UI.Control control

The control to focus when the event is triggered

Properties

Focus

Gets or sets a value indicating whether this SetFocusEvent will give focus to the control.

Declaration
public bool Focus { get; set; }
Property Value
Type Description
System.Boolean

Select

Gets or sets a value indicating whether this SetFocusEvent will select the text of the control.

Declaration
public bool Select { get; set; }
Property Value
Type Description
System.Boolean

TargetControlClientId

Gets or sets the client side id of the target control. This is the control which will receive focus and/or select when the event occurs.

Declaration
public string TargetControlClientId { get; set; }
Property Value
Type Description
System.String

Returns System.String.Empty if undefined or set to null.

Methods

AttachEvent(ScriptManager, String)

AttachEvent is responsible for adding the event to the scriptmanager. This method must be overridden by all control developers inheriting this class.

Declaration
public override void AttachEvent(ScriptManager scriptManager, string clientId)
Parameters
Type Name Description
ScriptManager scriptManager

The ScriptManager to create the events in.

System.String clientId

Client side id of the element that will raise the event

Overrides

Extension Methods