How to: Add and Configure an Image Control
You can add an Image control to display an image. Setting the value of the ImageUrl property causes the server to send the specified image to all mobile devices. However, you can override properties and use device filters to select alternate images targeted to the capabilities of specific device types. The Image control's NavigateUrl property enables your application to use an image as a hyperlink.
To add an Image control to an ASP.NET mobile Web page
Create the image file for the Image control to display.
In Solution Explorer, add the image to the project. This helps ensure that the image stays with the project through deployment.
Link the Image control to a .gif, .jpg, or other Web graphic file by doing the following:
In the Properties window, specify the image URL for the ImageUrl property.
- or -
In the Properties window, click the ellipsis button () for the ImageUrl property and then use the Select Image dialog box to browse to the location of the image file. Alternatively, if the image was added to the project, you can select it file from the Contents box.
For information about these and other properties, see Base Mobile Control Properties.
To display an image based on device characteristics
In the Properties window, in the AppliedDeviceFilters box, click the ellipsis button ().
The Applied Device Filters dialog box is displayed.
Before you can edit the device filters, you must add a mobile Web configuration file (a Web.config file for mobile controls) to your project, which contains a default <deviceFilters> section.
After you select all the device filters that your application will apply to the image, click OK.
In the Properties window, in the PropertyOverrides box, click the ellipsis button ().
The Property Overrides dialog box is displayed.
In the Applied Device Filter list, select a device filter.
In the ImageUrl property, enter the URL of the image to use for the current device filter.
To make an image a link
Add the image to a container control or to a control template.
In the Properties window, enter a URL in the NavigateUrl property.