Calendar input value overwritten on postback

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?S2VsbHk=?=

    Calendar input value overwritten on postback

    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?
  • Alexey Smirnov

    #2
    Re: Calendar input value overwritten on postback

    On Oct 14, 11:18 pm, Kelly <Ke...@discussi ons.microsoft.c omwrote:
    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.IsPostBac k)
    cal_value = ...
    else
    cal_value = ...

    Hope this helps

    Comment

    Working...