My ASP.TextBox does not accept AutoPostBack

0

Good! I am working with ASP.NET and in two TextBox I am using DatetimePicker from Bootstrap. I would like to put an AutoPostBack to the second TextBox to calculate the time difference of both and show it in another control but it does not do anything and I need help. Thanks in advance.

<div class="form-group text-center">
                                    <label> Hora de Llegada</label>
                                    <asp:TextBox ID="txtHoraLlegada" runat="server" CssClass="form-control" 
                                    AutoPostBack="true" ontextchanged="txtHoraLlegada_TextChanged"  />
                                        <div class="input-group date">
                            </div>
                                    <script type="text/javascript">
                                        $(function () {
                                            $('#<%=txtHoraLlegada.ClientID %>').datetimepicker();
                                        });

                                    </script>
                                </div>
    
asked by Kiara Pichardo 24.08.2016 в 15:48
source

1 answer

0

To post an event from javascript you should use __doPostBack

__doPostBack function

As you will see, a submit is done but you indicate the EVENTTARGET to be redirected to the corresponding control event

<script>
function __doPostBack( eventTarget, eventArgument )
{
    document.Form1.__EVENTTARGET.value = eventTarget;
    document.Form1.__EVENTARGUMENT.value = eventArgument;
    document.Form1.submit();
}
</script> 

You should in your case associate an event with datetimepicker to capture when a date is selected and there invoke the __doPostBack

    
answered by 24.08.2016 в 16:42