ASP.NET HtmlImage Control

## ASP.NET Tutorial

ASP.NET HOME ASP.NET Intro

## WP Tutorial

WebPages Intro WebPages Razor WebPages Layout WebPages Folders WebPages Global WebPages Forms WebPages Objects WebPages Files WebPages Databases WebPages Helpers WebPages WebGrid WebPages Charts WebPages Email WebPages PHP WebPages Publish WebPages Examples

## WP References

WebPages Classes WebPages Security WebPages Database WebPages WebMail WebPages Helpers

## ASP.NET Razor

Razor Intro Razor Syntax Razor C# Variables Razor C# Loops Razor C# Logic Razor VB Variables Razor VB Loops Razor VB Logic

## ASP.NET MVC

MVC Intro MVC Application MVC Folders MVC Layout MVC Controllers MVC Views MVC Database MVC Models MVC Security MVC HTML Helpers MVC Publish MVC Reference

## WF Tutorials

WebForms Intro WebForms Pages WebForms Controls WebForms Events WebForms Forms WebForms ViewState WebForms TextBox WebForms Button WebForms Data Binding WebForms ArrayList WebForms Hashtable WebForms SortedList WebForms XML Files WebForms Repeater WebForms DataList WebForms DbConnection WebForms Master Pages WebForms Navigation WebForms Examples

## WF References

WebForms HTML WebForms Controls WebForms Validation

# ASP.NET HtmlImage Control

HTML Server Controls

## Definition and Usage

The HtmlImage control is used to control an <img> element. In HTML, the <img> element is used to display an image.

## Properties

Property | Description
--- | ---

Align

How to align the image according to surrounding elements. Legal values are:

- top
- middle
- bottom
- left
- right

Alt | A short description of the image
Attributes | Returns all attribute name and value pairs of the element
Border | The width of the borders around the image
Disabled | A Boolean value that indicates whether or not the control should be disabled. Default is false
Height | The height of the image
id | A unique id for the control
runat | Specifies that the control is a server control. Must be set to "server"
Src | The URL of the image to display
Style | Sets or returns the CSS properties that are applied to the control
TagName | Returns the element tag name
Visible | A Boolean value that indicates whether or not the control should be visible
Width | The width of the image

## Examples

HTMLImage
Declare an HtmlImage control in an .aspx file (remember to embed the control inside an HtmlForm control). Then we modify the src, alt and border properties of the HtmlImage control in an event handler (an event handler is a subroutine that executes code for a given event). The Page_Load event is one of many events that ASP .NET understands:

HTMLImage 2
Declare an HtmlImage and an HTMLSelect control in an .aspx file (remember to embed the controls inside an HtmlForm control). Then we modify the src property of the HtmlImage control based on user choices. The value selected in the HtmlSelect control determines which image to display.

HTML Server Controls

## Your suggestion:

Your E-mail (optional):

Page address:

Description:

Close [X]

## Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

## WEB HOSTING

Best Web Hosting UK Reseller Hosting Wow! $5 SSD Hosting

## WEB BUILDING

Download XML Editor
FREE Website BUILDER FREE Website Creator

## WEB RESOURCES

Web Statistics Web Validation

## SHARE THIS PAGE