System.Web.UI.WebControls.TextBox.ReadOnly Property

Gets or sets a value indicating whether the contents of the System.Web.UI.WebControls.TextBox control can be changed.

Syntax

[System.Web.UI.Themeable(false)]
[System.ComponentModel.DefaultValue(false)]
[System.ComponentModel.Bindable(true)]
public virtual bool ReadOnly { set; get; }

Value

Documentation for this section has not yet been entered.

Remarks

Use the TextBox.ReadOnly property to specify whether the contents of the System.Web.UI.WebControls.TextBox control can be changed. Setting this property to true will prevent users from entering a value or changing the existing value. Note that the user of the System.Web.UI.WebControls.TextBox control cannot change this property; only the developer can.

Note:

The TextBox.Text value of a System.Web.UI.WebControls.TextBox control with the TextBox.ReadOnly property set to true is sent to the server when a postback occurs, but the server does no processing for a read-only text box. This prevents a malicious user from changing a TextBox.Text value that is read-only. The value of the TextBox.Text property is preserved in the view state between postbacks unless modified by server-side code.

This property cannot be set by themes or style sheet themes. For more information, see System.Web.UI.ThemeableAttribute and ASP.NET Themes Overview.

Requirements

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0