Bewerken

Share via


Image.GenerateEmptyAlternateText Property

Definition

Gets or sets a value indicating whether the control generates an alternate text attribute for an empty string value.

public:
 virtual property bool GenerateEmptyAlternateText { bool get(); void set(bool value); };
public virtual bool GenerateEmptyAlternateText { get; set; }
member this.GenerateEmptyAlternateText : bool with get, set
Public Overridable Property GenerateEmptyAlternateText As Boolean

Property Value

true if the control generates the alternate text attribute for an empty string value; otherwise, false. The default is false.

Remarks

By default, when the AlternateText property is not set, the Image control does not include the alt attribute to specify the alternate text in the control rendering. Set the GenerateEmptyAlternateText property to true to always include the alternate text attribute in rendered output for the Image control.

The XHTML document type definition requires the alt attribute on image controls. However, accessibility best practices recommend that image controls that do not convey information relevant to the context of the Web page should not specify an alt attribute. You can meet both XHTML and accessibility requirements by setting the GenerateEmptyAlternateText property to true.

Applies to

See also