ImageField.NullImageUrl Property

Gets or sets the URL to an alternate image displayed in an ImageField object when the value of the field specified by the DataImageUrlField property is a null reference (Nothing in Visual Basic).

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

public:
virtual property String^ NullImageUrl {
	String^ get ();
	void set (String^ value);
}
/** @property */
public String get_NullImageUrl ()

/** @property */
public void set_NullImageUrl (String value)

public function get NullImageUrl () : String

public function set NullImageUrl (value : String)

Not applicable.

Property Value

The URL to an alternate image displayed when the value of a field is a null reference (Nothing in Visual Basic). The default is an empty string (""), which indicates that this property is not set.

When the value of the field specified by the DataImageUrlField property is a null reference (Nothing in Visual Basic), an image cannot be displayed in an ImageField object. Use the NullImageUrl property to specify the URL to an alternate image to display. The alternate image is usually an image that indicates that the normal image is not available or cannot be found.

NoteNote:

As an alternative, you can simply display text when the field value is a null reference (Nothing in Visual Basic) by setting the NullDisplayText property instead of this property. If the NullImageUrl and NullDisplayText properties are both set, the NullImageUrl property has precedence.

The following example demonstrates how to use the NullImageUrl property to specify the URL to an alternate image to display when the value of the field specified by the DataImageUrlField property is a null reference (Nothing in Visual Basic).

No code example is currently available or this language may not be supported.

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.

.NET Framework

Supported in: 3.0, 2.0

Community Additions

ADD
Show: