简体   繁体   中英

Get values of a textbox changed by javascript

strange bug:

i have an ajax datepicker added to a text box of my form.

i submit the form.. and I could receive all values excepting those of the datepicker checkboxes.

why is the .Text property empty of this elements?

Thanks

Is your TextBox disabled for user input, so that it might only be changed by javascript, by the datepicker?

The problem in that case, is that .NET "knows" that the control is disabled, and just assumes that the value cannot, then, have changed since it was rendered. So .NET will use the ViewStated value immediately, without checking the POST data.

There are two solutions to this:

  1. Don't render the TextBox as disabled, but disable it with the datepicker script

  2. Instead of relying on the TextBox's Text property, check Request.Form[myTextBox.ClientID]

尝试访问SelectedDate而不是Text。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM