views:

64

answers:

2

hi

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

A: 

Try accessing SelectedDate instead of Text.

AaronLS
it's a textbox which hasn't a SelectedDate property :(
snarebold
Oh sorry, I was referring to a DatePicker control.
AaronLS
+2  A: 

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]

David Hedlund
yes it's disabled by javascript :) but it needs to. i try your second solution
snarebold
really thanks my hero. your are it!
snarebold