Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>As others said ReadOnly="True" will break the postback mechanism. </p> <p>I believe you can get around it in your code-behind by accessing the Request object directly during PageLoad:</p> <pre><code>//assuming your textbox ID is 'txtDate' if(Page.IsPostBack) { this.txtDate.Text = Request[this.txtDate.UniqueID]; } </code></pre> <p>Your other option is to allow Disabled controls to postback on the form, but this is somewhat of a security concern as readonly fields modified via script could potentially come back:</p> <pre><code>&lt;form id="MyForm" runat="server" SubmitDisabledControls="True"&gt; .. &lt;/form&gt; </code></pre> <p><a href="http://msdn.microsoft.com/en-us/library/system.web.ui.htmlcontrols.htmlform.submitdisabledcontrols.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/system.web.ui.htmlcontrols.htmlform.submitdisabledcontrols.aspx</a></p> <p>I'm not sure the impact of this property on ReadOnly (vs Enabled="False") controls but it's worth trying.</p> <p>And finally - I did run into the same issue you're having a few years ago, and from what I remember there is a difference between using an html input marked as readonly and runat="server", and an actual serverside control where ReadOnly="true".</p> <p>I have a feeling doing:</p> <pre><code>&lt;input type="text" readonly="readonly" runat="server" id="myTextBox" /&gt; </code></pre> <p>may have still allowed the data to come through, although in the code-behind you have to treat the control as a HtmlInputText or HtmlGenericControl vs. a TextBox. You can still access the properties you need though.</p> <p>Just a few ideas anyway...</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload