ASP.NET 4 Unleashed

This quick reference provides a list of the important properties, methods , and events of each HTML control. See Chapter 1, "Building ASP.NET Pages," for more information on using these controls within an ASP.NET page.

Table . HtmlAnchor Control Properties, Methods, and Events

Properties

Description

Attributes

Returns a collection of all attributes of the control.

Disabled

Specifies a Boolean value indicating whether the control is disabled on the form.

HRef

Indicates the URL that is the target of the link.

InnerHtml

Specifies the HTML content that appears within the tag.

InnerText

Specifies the text content that appears within the tag.

Name

Specifies the unique identifier for the control.

Style

Returns a collection of style attributes for the control.

TagName

Returns the name of the tag used when rendering the control.

Target

Displays the page in this window or frame when you click the banner advertisement. Possible values are _top , _new , _child , _self , _ parent , and _blank .

Title

Indicates the title of the document being linked. The title also appears as a ToolTip in certain browsers.

Methods

Description

OnServerClick

Raises the ServerClick event.

Events

Description

ServerClick

Raised when a user clicks the control.

Table . HtmlButton Control Properties, Methods, and Events

Properties

Description

Attributes

Returns a collection of all attributes of the control.

CausesValidation

Does not perform validation when the form containing the button is submitted when this property is set to False .

Disabled

Specifies a Boolean value indicating whether the control is disabled on the form.

InnerHtml

Specifies the HTML content that appears within the tag.

InnerText

Specifies the text content that appears within the tag.

Style

Returns a collection of style attributes for the control.

TagName

Returns the name of the tag used when rendering the control.

Events

Description

OnServerClick

Raises the ServerClick event.

Events

Description

ServerClick

Raised when a user clicks the control.

Table . HtmlForm Control Properties, Methods, and Events

Properties

Description

Attributes

Returns a collection of all attributes of the control.

Disabled

Specifies a Boolean value indicating whether the form is disabled.

Enctype

Identifies a string that specifies the encoding type used to encode the form data. Possible values include application/x-www-form-urlencoded , multipart/_form-data , and text/plain .

InnerHtml

Specifies the HTML content that appears within the tag.

InnerText

Specifies the text content that appears within the tag.

Method

Identifies a string that specifies how form data should be posted. Possible values include Post and Get . If you change this property from its default value of Get , view state might fail.

Name

Returns the name of the HtmlForm .

Style

Returns a collection of style attributes for the control.

TagName

Returns the name of the tag used when rendering the control.

Target

Displays the page in this window or frame when you click the banner advertisement. Possible values are top , new , child , self , parent , and blank .

Methods

Description

None

 

Events

Description

None

 
Table . HtmlGenericControl Control Properties, Methods, and Events

Properties

Description

Attributes

Returns a collection of all attributes of the control.

Disabled

Specifies a Boolean value indicating whether the control is disabled on the form.

InnerHtml

Specifies the HTML content that appears within the tag.

InnerText

Specifies the text content that appears within the tag.

Style

Returns a collection of style attributes for the control.

TagName

Returns the name of the tag used when rendering the control.

Methods

Description

None

 

Events

Description

None

 
Table . HtmlImage Control Properties, Methods, and Events

Properties

Description

Align

Identifies a string that specifies the alignment of the image within the page. Possible values include left , center , right , top , and bottom .

Alt

Specifies the alternative text that is displayed on browsers that do not support images.

Attributes

Returns a collection of all attributes of the control.

Border

Indicates the width in pixels of the border around the image.

Disabled

Specifies a Boolean value indicating whether the control is disabled on the form.

Height

Specifies the height of the image in pixels.

Src

Specifies the URL of the image file to display.

Style

Returns a collection of style attributes for the control.

TagName

Returns the name of the tag used when rendering the control.

Width

Specifies the width of the image in pixels.

Methods

Description

None

 

Events

Description

None

 
Table . HtmlInputButton Control Properties, Methods, and Events

Properties

Description

Attributes

Returns a collection of all attributes of the control.

CausesValidation

Does not perform validation when the form containing the button is submitted when this property is set to False .

Disabled

Specifies a Boolean value indicating whether the control is disabled on the form.

Name

Specifies the unique identifier for the control.

Style

Returns a collection of style attributes for the control.

TagName

Returns the name of the tag used when rendering the control.

Type

Specifies a string representing the type of the input control.

Value

Specifies the text used to label the button.

Methods

Description

OnServerClick

Raises the ServerClick event.

Events

Description

ServerClick

Raised when a user clicks the control.

Table . HtmlInputCheckBox Control Properties, Methods, and Events

Properties

Description

Attributes

Returns a collection of all attributes of the control.

Checked

Specifies a Boolean value indicating whether the check box is checked.

Disabled

Specifies a Boolean value indicating whether the control is disabled on the form.

Name

Specifies the unique identifier for the control.

Style

Returns a collection of style attributes for the control.

TagName

Returns the name of the tag used when rendering the control.

Type

Specifies a string representing the type of the input control.

Value

Specifies a string representing the contents of the control.

Methods

Description

OnServerChange

Raises the ServerChange event.

Events

Description

ServerChange

Raised when a check box is checked or unchecked.

Table . HtmlInputFile Control Properties, Methods, and Events

Properties

Description

Accept

Contains a comma-separated list of MIME types that indicate the type of file that can be uploaded ”for example, image/gif,image/jpeg .

Attributes

Returns a collection of all attributes of the control.

Disabled

Specifies a Boolean value indicating whether the control is disabled on the form.

Maxlength

Specifies the maximum length of the file path for the file being uploaded.

Name

Specifies the unique identifier for the control.

PostedFile

Contains an instance of the HttpPostedFile class that represents the file uploaded.

Size

Specifies the width of the text box in which the file path is entered.

Style

Returns a collection of style attributes for the control.

TagName

Returns the name of the tag used when rendering the control.

Type

Specifies a string representing the type of the input control.

Value

Specifies a string representing the contents of the control.

Methods

Description

None

 

Events

Description

None

 
Table . HtmlInputHidden Control Properties, Methods, and Events

Properties

Description

Attributes

Returns a collection of all attributes of the control.

Disabled

Specifies a Boolean value indicating whether the control is disabled on the form.

Name

Specifies the unique identifier for the control.

Style

Returns a collection of style attributes for the control.

TagName

Returns the name of the tag used when rendering the control.

Type

Specifies a string representing the type of the input control.

Value

Specifies a string representing the contents of the control.

Methods

Description

OnServerChange

Raises the ServerChange event.

Events

Description

ServerChange

Raised when the contents of the control are changed.

Table . HtmlInputImage Control Properties, Methods, and Events

Properties

Description

Align

Identifies a string that specifies the alignment of the image within the page. Possible values include left , center , right , top , and bottom .

Alt

Specifies the alternative text that is displayed on browsers that do not support images.

Attributes

Returns a collection of all attributes of the control.

Border

Specifies the width in pixels of the border around the image.

CausesValidation

Does not perform validation when the form containing the button is submitted when this property is set to False .

Disabled

Specifies a Boolean value indicating whether the control is disabled on the form.

Name

Specifies the unique identifier for the control.

Src

Specifies the URL of the image file to display.

Style

Returns a collection of style attributes for the control.

TagName

Returns the name of the tag used when rendering the control.

Type

Specifies a string representing the type of the input control.

Value

Specifies a string representing the contents of the control.

Methods

Description

OnServerClick

Raises the ServerClick event.

Events

Description

ServerClick

Raised when the control is clicked.

Table . HtmlInputRadioButton Control Properties, Methods, and Events

Properties

Description

Attributes

Returns a collection of all attributes of the control.

Checked

Specifies a Boolean value indicating whether the radio button is checked.

Disabled

Specifies a Boolean value indicating whether the control is disabled on the form.

Name

Specifies the unique identifier for the control.

Style

Returns a collection of style attributes for the control.

TagName

Returns the name of the tag used when rendering the control.

Type

Specifies a string representing the type of the input control.

Value

Specifies a string representing the contents of the control.

Methods

Description

None

 

Events

Description

None

 
Table . HtmlInputText Control Properties, Methods, and Events

Properties

Description

Attributes

Returns a collection of all attributes of the control.

Disabled

Specifies a Boolean value indicating whether the control is disabled on the form.

MaxLength

Specifies the maximum number of characters that can be entered into the text box.

Name

Specifies the unique identifier for the control.

Size

Specifies the size of the text box in characters.

Style

Returns a collection of style attributes for the control.

TagName

Returns the name of the tag used when rendering the control.

Type

Specifies a string representing the type of the input control.

Value

Specifies a string representing the contents of the control.

Methods

Description

OnServerChange

Raises the ServerChange event.

Events

Description

ServerChange

Raised when the contents of the text box are changed.

Table . HtmlSelect Control Properties, Methods, and Events

Properties

Description

Attributes

Returns a collection of all attributes of the control.

DataMember

Identifies the table in the data source to bind to the control.

DataSource

Identifies the source for the data displayed by the control.

DataTextField

Identifies the field in the data source used for the text for each option.

DataValueField

Identifies the field in the data source used for the value for each option.

Disabled

Specifies a Boolean value indicating whether the control is disabled on the form.

InnerHtml

Specifies the HTML content that appears within the tag.

InnerText

Specifies the text content that appears within the tag.

Items

Returns a collection of ListItem objects that represent the options in the select list.

Multiple

Specifies a Boolean value indicating whether multiple options can be selected.

SelectedIndex

Specifies the index of the currently selected option.

Size

Displays a scrolling list box when this property is set to greater than 1 .

Style

Returns a collection of style attributes for the control.

TagName

Returns the name of the tag used when rendering the control.

Value

Specifies a string representing the contents of the control.

Methods

Description

OnServerChange

Raises the ServerChange event.

Events

Description

ServerChange

Raised when a new option is selected.

Table . HtmlTable Control Properties, Methods, and Events

Properties

Description

Align

Identifies a string that specifies the alignment of the contents of the table. Possible values include left , center , and right .

Attributes

Returns a collection of all attributes of the control.

BgColor

Identifies a string specifying the background color of the table.

Border

Identifies an integer representing the width of the table border in pixels.

BorderColor

Identifies a string specifying the color of the table border.

CellPadding

Specifies the amount of padding in pixels within each table cell .

CellSpacing

Specifies the amount of padding in pixels between each table cell.

Disabled

Specifies a Boolean value indicating whether the control is disabled on the form.

Height

Specifies the height of the table in pixels.

InnerHtml

Specifies the HTML content that appears within the tag.

InnerText

Specifies the text content that appears within the tag.

Rows

Returns a collection of TableRow objects contained in the table.

Style

Returns a collection of style attributes for the control.

TagName

Returns the name of the tag used when rendering the control.

Width

Specifies the width of the table in pixels.

Methods

Description

None

 

Events

Description

None

 
Table . HtmlTableCell Control Properties, Methods, and Events

Properties

Description

Align

Identifies a string that specifies the alignment of the contents of the cell. Possible values include left , center , and right .

Attributes

Returns a collection of all attributes of the control.

BgColor

Identifies a string specifying the background color of the cell.

BorderColor

Identifies a string specifying the color of the cell border.

ColSpan

Specifies the number of columns that the cell spans .

Disabled

Specifies a Boolean value indicating whether the control is disabled on the form.

Height

Specifies the height of the cell in pixels.

InnerHtml

Specifies the HTML content that appears within the tag.

InnerText

Specifies the text content that appears within the tag.

NoWrap

Does not word-wrap contents of the cell when this property is set to True .

RowSpan

Specifies the number of rows that the cell spans.

Style

Returns a collection of style attributes for the control.

TagName

Returns the name of the tag used when rendering the control.

VAlign

Specifies the vertical alignment of the contents of the cell. Possible values include top , middle , bottom , and baseline .

Width

Specifies the width of the cell in pixels.

Methods

Description

None

 

Events

Description

None

 
Table . HtmlTableRow Control Properties, Methods, and Events

Properties

Description

Align

Identifies a string that specifies the alignment of the cells contained in the row. Possible values include left , center , and right .

Attributes

Returns a collection of all attributes of the control.

BgColor

Identifies a string specifying the background color of the row.

BorderColor

Identifies a string specifying the color of the row border.

Cells

Returns a collection of TableCell objects contained in the row.

Disabled

Specifies a Boolean value indicating whether the control is disabled on the form.

Height

Specifies the height of the row in pixels.

InnerHtml

Specifies the HTML content that appears within the tag.

InnerText

Specifies the text content that appears within the tag.

Style

Returns a collection of style attributes for the control.

TagName

Returns the name of the tag used when rendering the control.

VAlign

Specifies the vertical alignment of the contents of the cells contained in the row. Possible values include top , middle , bottom , and baseline .

Methods

Description

None

 

Events

Description

None

 
Table . HtmlTextArea Control Properties, Methods, and Events

Properties

Description

Attributes

Returns a collection of all attributes of the control.

Cols

Specifies the width of the text area in characters.

Disabled

Specifies a Boolean value indicating whether the control is disabled on the form.

InnerHtml

Specifies the HTML content that appears within the tag.

InnerText

Specifies the text content that appears within the tag.

Name

Specifies the unique identifier for the control.

Rows

Specifies the height of the text area in characters.

Style

Returns a collection of style attributes for the control.

TagName

Returns the name of the tag used when rendering the control.

Value

Specifies a string representing the contents of the control.

Methods

Description

OnServerChange

Raises the ServerChange event.

Events

Description

ServerChange

Raised when the contents of the text area are changed.

Категории