How to: Set ASP.NET Web Server Control Properties
Setting a control's properties defines its appearance and behavior. This topic addresses how to set control properties declaratively.
To set server controls properties
In the ASP.NET Web page, 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. For information about the properties for a specific control, search for the name of the control class (for example, "Button class (System.Web.UI.WebControls)" in the Help index.
A TextBox accepts user input, which is a potential security threat. By default, ASP.NET Web pages validate that user input does not include script or HTML elements. For more information, see Script Exploits Overview.
<asp:textbox id="TextBox1" runat=server maxlength=20 />
In Web server controls, any attribute that does not map to a property of the control is passed as-is to the browser.