ASP.NET TextBox control in the establishment of ReadOnly = "true" background to get any value

SP.NET the TextBox control set ReadOnly = "true" H or fail to Enabled = false background value
 
when the ReadOnly = TextBox set "true", if the added value for the control in the foreground, the background is not taken, the value Is empty" .
 
  
 
Method a: ReadOnly property is not set, simulated by οnfοcus = this.blur (), as follows:
 
<ASP: the TextBox ID = "TextBox1" the runat = "Server" οnfοcus = this.blur ()> </ ASP: the TextBox>
 
  
 
Method II: ReadOnly property is set to the value by Request, as follows:
 
front Code:
 
<ASP: the TextBox ID = "TextBox1" the runat = "Server" ReadOnly = "True"> </ ASP: the TextBox>
 
 background Code:
 
String the Text = Request.Form [ "TextBox1"] Trim ();.
 
  
 
method three: in the Page_Load () n the text box read-only attribute is not set in the foreground. Can normally read as follows:
 
protected void the Page_Load (Object SENDER, EventArgs E)
    {
        (! The Page.IsPostBack) IF
        {
            TextBox1.Attributes.Add ( "

Guess you like

Origin www.cnblogs.com/Jeremy2001/p/11294296.html