Image.GenerateEmptyAlternateText Property (System.Web.UI.WebControls)

Switch View :
ScriptFree
Image.GenerateEmptyAlternateText Property
Gets or sets a value indicating whether the control generates an alternate text attribute for an empty string value.

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in system.web.dll)

Syntax

Visual Basic (Declaration)
Public Overridable Property GenerateEmptyAlternateText As Boolean
Visual Basic (Usage)
Dim instance As Image
Dim value As Boolean

value = instance.GenerateEmptyAlternateText

instance.GenerateEmptyAlternateText = value
C#
public virtual bool GenerateEmptyAlternateText { get; set; }
C++
public:
virtual property bool GenerateEmptyAlternateText {
	bool get ();
	void set (bool value);
}
J#
/** @property */
public boolean get_GenerateEmptyAlternateText ()

/** @property */
public void set_GenerateEmptyAlternateText (boolean value)

JScript
public function get GenerateEmptyAlternateText () : boolean

public function set GenerateEmptyAlternateText (value : boolean)

XAML
Not applicable.

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 controls not specify empty alternate-text attributes. You can meet both XHTML and accessibility requirements by setting the AlternateText property to a string describing the image; this generates an alt attribute for the control and sets the attribute to a meaningful value.

Platforms

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

Version Information

.NET Framework

Supported in: 3.0, 2.0
See Also