Calendar input value overwritten on postback

  • Thread starter Thread starter Kelly
  • Start date Start date
K

Kelly

I am using javascript to dynamically create a date picker input control on a
..Net webform. On postback, the selected value gets overwritten by the default
value generated by the javascript. What can I do?
 
I am using javascript to dynamically create a date picker input control on a
.Net webform. On postback, the selected value gets overwritten by the default
value generated by the javascript. What can I do?

Hi Kelly

it will depend on how it is implemented. I think you can try to use a
hidden variable which would change its value after postback. The value
must be checked in the javascript after that. You can also inject the
javascript code on a postback, for example

<script>
var default_value=<%=cal_value%>
</script>

in the code-behind

if (Page.IsPostBack)
cal_value = ...
else
cal_value = ...

Hope this helps
 
Back
Top