Setting a textbox value by JQuery
<p>I am setting a <code>TextBox</code> controls value via an ajax post.</p>

<pre><code>$('#txtSite').val(msg.d.SiteName);
</code></pre>

<p>This is working and the value of the <code>TextBox</code> is altered correctly.  But, when I come to posting the information to the database, the <code>txtSite.Text</code> value is empty!!</p>

<p>Any ideas?  Am I going mad?</p>

<p>Code to populate the <code>TextBox</code>:</p>

<pre><code>$.ajax({
    type:"POST",
    url: "MyPage.aspx/ValidateSite",
    data: "{ siteID: '" + $('#txtSiteID').val() + "' }",
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    success: function(msg) {
        if (msg.d != null) {
            $('#txtSite').val(msg.d.SiteName);  // It's definitely doing this
        }
        else {
            $('#txtSite').val('');
        }
    },
    error: function(msg) {
    }
});
</code></pre>

<p>Code to save to the server (all connectivity etc. is correct and working).  This code is in an ASP button click event:</p>

<pre><code>SqlCommand cmd = new SqlCommand("INSERT INTO [Sites] ([SiteName]) VALUES ('" + txtSite.Text + "')", conn);
cmd.ExecuteNonQuery();
</code></pre>

<p>The <code>TextBox</code> is defined like so:</p>

<pre><code>&lt;asp:TextBox ID="txtSite" runat="server" AutoComplete="off" TabIndex="4" MaxLength="50" Style="width: 230px" Enabled="false" CssClass="FormDisabledTextWithSmallHeight" /&gt;
</code></pre>

<p>I have also tried changing my JQuery to use plain Javascript instead and doing this:</p>

<pre><code>document.getElementById("txtSite").value = msg.d.SiteName;
</code></pre>

<p>Still returns me an empty value.</p>
