title: Put readonly attribute on TextBox Control in markup?
body: <p>I have a TextBox control and I want the rendered input element to have the <code>readonly</code> attribute with value <code>readonly</code>:</p>
  
  <pre><code>&lt;input type="text" readonly="readonly" /&gt;
  </code></pre>
  
  <p>I could do it in code-behind using the following code:</p>
  
  <pre><code>textBox.Attributes["readonly"] = "readonly"
  </code></pre>
  
  <p>but I'd rather have all my control attributes and their values in my markup. Can I do it in the markup?<br>
  A solution could be to extend the TextBox control, but this feels overly complicated for the intended result.</p>
  
  <p><br/>
  I want to be able to change the value client-side with javascript, and read the value server-side during postbacks. Please note that putting the <code>TextBox.ReadOnly</code> property to <code>True</code> would <em>not</em> solve the issue, as this also causes the server to ignore the TextBox' value on postbacks. (<a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.textbox.readonly.aspx" rel="nofollow">MSDN</a>.) I simply want the readonly behavior from the browser.</p>