asp.net.ph

Skip Navigation Links

Setting Web Forms Server Control Properties

ASP.NET Web Forms   Web Forms Server Controls   Programming Web Forms Server Controls


Setting a control’s properties defines its appearance and behavior. This topic addresses how to set control properties at design time.

Setting Properties using ASP.NET Syntax

Control properties can be set as part of a control’s declaration.

  • In the .aspx file, set the attribute of the control declaration corresponding to the property you want. The exact attribute you set depends on the control and the property.

    NOTE: In Web server controls, the property names do not have the same names as HTML attributes; be sure you are using the correct property name.

The following example sets the MaxLength property of an HtmlInputText HTML server control:

<INPUT id="myTextBox" type=text runat=server maxlength=20>

The following example sets the TextBoxMode property of TextBox ASP.NET control:

<asp:TextBox Text="Hi" runat=server TextBoxMode=Multiline />
See Also

Setting Web Server Control Properties Programmatically   Setting HTML Server Control Properties Programmatically   Web Forms Server Controls and CSS Styles



© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note