Calendar input value overwritten on postback

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?
 
A

Alexey Smirnov

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top