Tuesday, August 10, 2010

Setting Web Server Control Properties & Common Web Server Control Properties

Setting Web Server Control Properties


Most Web server controls inherit from the WebControl class. All Web server controls must contain a unique (at the page level) ID attribute value to give you a way to programmatically reference the control. The other attributes and properties of a Web server control are used to control the look and behavior of the control.

Common Web Server Control Properties:

AccessKey The keyboard shortcut key. It can specify a single letter or number that the user can press while holding down Alt. For example, specify “Q” if you want the user to press Alt+Q to access the control. The property is supported only in Microsoft Internet Explorer 4.0 and later.

Attributes A collection of additional attributes on the control that is not defined by a public property, but that should be rendered in the primary HTML element of this control. This allows you to use an HTML attribute that is not directly supported by the control. This property is accessible programmatically; it cannot be set in the designer

BackColor The background color of the control, which can be set using standard HTML color identifiers, such as “red” or “blue,” or RGB values expressed in hexadecimal format (“#ffffff”).

BorderColor The border color of the control, which can be set using standard HTML color identifiers, such as “black” or “red,” or RGB values expressed in hexadecimal format (“#ffffff”).

BorderWidth The width of the control’s border in pixels. Not fully supported for all controls in browsers earlier than Internet Explorer 4.0

BorderStyle The border style, if there is any. Possible values are NotSet, None, Dotted, Dashed, Solid, Double, Groove, Ridge, Inset, and Outset

CssClass The CSS class to assign to the control.

Style A list of all CSS properties that are applied to the specified HTML server control

Enabled An attribute that disables the control when set to false. This dims the control and makes it inactive. It does not hide the control

EnableTheming The default is true, which enables themes for this control.

EnableViewState The default is true, which enables view state persistence for the control

Font An attribute that contains sub properties that you can declare using the property-sub property syntax in the opening tag of a Web server control element. For example, you can make a Web server control’s text

italic by including the Font-Italic attribute in its opening tag.

ForeColor The foreground color of the control. It is not fully supported for all controls in browsers earlier than Internet Explorer 4.0.

Height The control’s height. It is not fully supported for all controls in browsers earlier than Internet Explorer 4.0.

SkinID The skin to apply to the control

TabIndex The control’s position in the tab order. If this property is not set, the control’s position index is 0. Controls with the same tab index can be tabbed according to the order in which they are declared in the Web

page. This works only in Internet Explorer 4.0 and later.

ToolTip The text that appears when the user hovers the mouse pointer over a control. The ToolTip property does not work in all browsers.

Width The width of the control. The possible units are Pixel, Point, Pica, Inch, Mm, Cm, Percentage, Em, and Ex. The default unit is pixels.

No comments: