1. Differences between readonly = 'true' and enabled = 'false' in textbox attributes
The HTML server control uses a class derived from the htmlcontrol base class (full Class Name: system. Web. UI. htmlcontrols). Only the disabled property is available in this class.
Per W3C specification: http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.12
The textbox of the readonly attribute will display such a mark on the client:
<Input readonly = "readonly">
The following restrictions apply to input with readonly:
<1> acceptable focus, but not modifiable <2> navigation using the tab key <3> Successful
The textbox of the enabled attribute will present such a flag on the client:
<Input Disabled = "disabled">
If the input parameter is set to disabled, the following restrictions apply:
<1> acceptable focus <2> skipped when the tab key is used <3> it may not be successful
Only the form element of successful is valid data, that is, the text input boxes that can be submitted. Disabled and readonly can only be modified using scripts.
2. textmodel = 'Password' in textbox'
If you want to assign a value to the password box, textbox. Text = "XXX"; will not work.
Use the background registration: txtpassword. Attributes. Add ("value", "xxxxxx ");
3. Retain user input
The textbox server control does not exist. However, when you use the <input type = "text"/> client control, the value is cleared if the client is redirected to the control.
Required: <input type = "text" style = "behavior: URL (# default # savehistory);"/>
4. It can only be numbers (with flashing)
<Asp: textbox id = "textbox1" runat = "server"Onkeyup = "value = value. replace (/[^ \ D]/g, '')" onbeforepaste = "clipboardData. setdata ('text', clipboardData. getdata ('text '). replace (/[^ \ D]/g ,''))"> </ASP: textbox>
Test:
5. Only English and numbers can be entered (with flashing)
<Asp: textbox id = "textbox1" runat = "server"Onkeyup = "value = value. replace (/[\ W]/g, '')" onbeforepaste = "clipboardData. setdata ('text', clipboardData. getdata ('text '). replace (/[^ \ D]/g ,''))"> </ASP: textbox>
Test: