Note that there are some explanatory texts on larger screens.

plurals
  1. POasp.net textbox.text and jquery.val()
    primarykey
    data
    text
    <p>I'm reading the contents of a an asp.net TextBox on a button click event in the codebehind of a webpage.</p> <p>This works fine if I type something into the box I can read whats in there via TextBox.Text.</p> <p>However, if I copy into the input textbox using jquery, setting the contents using val(), I can see the text appear in the box but when the click event fires and I try to read the contents of the textbox it is always blank. There's only every anything in there if I type it in myself.</p> <p>The relevant bits of code are: - The input box</p> <pre><code>&lt;asp:TextBox runat="server" ID="deliveryAddress3" CssClass="required radius disabled sugestedAddressTargetCity bcity2" /&gt; </code></pre> <p>Javascript</p> <pre><code>var bfields = ['.baddress', '.bcity', '.bcountry', '.bpostcode']; var dfields = ['.baddress2', '.bcity2', '.bcountry2', '.bpostcode2']; for (var i in dfields) { $(dfields[i]).prev('label').hide(); $(dfields[i]).val($(bfields[i]).val()); $(dfields[i]).attr('disabled', 'disabled'); $(dfields[i]).addClass('disabled'); $(dfields[i]).attr('disabled', 'disabled'); </code></pre> <p>Code in button click method of codebehind: -</p> <pre><code>customer.DelTown = deliveryAddress3.Text; </code></pre> <p>Whats going on here is that the customer can copy their address from one set of boxes to another. If they do this (by clicking a button) the ext shows up in the boxes but in the code behind is blank. However, if I type something in to those boxes it is available in the code behind.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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