Back to Devexpress

ImagePropertiesBase.Url Property

aspnet-devexpress-dot-web-dot-imagepropertiesbase-b4312872.md

latest3.5 KB
Original Source

ImagePropertiesBase.Url Property

Gets or sets the URL of the image used for an element’s normal state.

Namespace : DevExpress.Web

Assembly : DevExpress.Web.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
[DefaultValue("")]
public virtual string Url { get; set; }
vb
<DefaultValue("")>
Public Overridable Property Url As String

Property Value

TypeDefaultDescription
StringString.Empty

A String value that specifies the location of an image.

|

Remarks

Use the Url property to specify the URL of an image which is defined by the current ImagePropertiesBase object, and is used to represent the corresponding element in the normal state.

You can use a relative or an absolute URL. A relative URL relates the location of the image to the location of the Web page, without specifying a complete path on the server. The path is relative to the location of the Web page. This makes it easier to move the entire site to another directory on the server without updating the code. An absolute URL provides the complete path, thus moving the site to another directory requires a code update.

An image’s size can be defined via the ImagePropertiesBase.Width and ImagePropertiesBase.Height properties. Note that in order to correctly display a PNG file with alpha channel at runtime, the image’s size (the ImagePropertiesBase.Width and ImagePropertiesBase.Height properties) should be specified explicitly.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Url property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

asp-net-web-forms-create-responsive-web-app/CS/ResponsiveWebApplication/Root.master.cs#L84

csharp
protected void ApplicationMenu_ItemDataBound(object source, MenuItemEventArgs e) {
    e.Item.Image.Url = string.Format("Content/Images/{0}.svg", e.Item.Text);
    e.Item.Image.UrlSelected = string.Format("Content/Images/{0}-white.svg", e.Item.Text);

See Also

Width

Height

ImagePropertiesBase Class

ImagePropertiesBase Members

DevExpress.Web Namespace