| |||||||||||
Image.ImageUrl PropertySystem.Web.UI.WebControls Namespace Image Class Sets or retrieves the path to an image file. Syntax
Property Value
The property is read/write with no default value. RemarksUse this property to specify the path to the image file to display. If the image file is in the same directory as the Web page that uses it, simply specify the file name. Otherwise, include the path to the file. The path can be absolute or relative to the directory where the Web page is located. You can use the relative path symbol [ ~/ ] to refer to the application root or virtual directory. If the path is relative, it is automatically converted to an absolute path when the Image control is rendered on the browser. This allows images, as well as other files that a Web page may be dependent on, such as user controls ( .ascx files ), to be more portable. For example, assuming the application virtual directory is aspxtreme, the path specified in the following declaration <asp:image imageurl = "~/shared/myGraphic.png" runat = "server" > will resolve to the absolute path <asp:image imageurl = "/aspxtreme/shared/myGraphic.png" runat = "server"> In certain cases, as when images or imagebuttons ( which inherit this property ) are used within templated controls, the ImageUrl property is usually obtained dynamically from a data source. ExampleThe following example shows how to declaratively set the ImageUrl property of an Image control at design time. <asp:image imageurl = "~/shared/aspxtreme.jpg" width=100 height=30 border=0 alternatetext = "Simply awesome" imagealign = "right" runat = "server" /> The following examples demonstrate how to dynamically bind the ImageUrl property of Image or ImageButton controls defined within templates.
See Also |
| ||||||||||
Check out related books at Amazon
© 2000-2008 Rey Nuñez All rights reserved.
If you have any question, comment or suggestion
about this site, please send us a note
You can help support aspxtreme