JQuery UI inline DatePicker loses selected date after ASP.NET postback, How to keep it?
Hello to All
I have a jquiry datepicker and the code is as below:
- <div id="test"></div>
<asp:TextBox ID="txtRDate" runat="server" Width="120px" ClientIDMode="Static" AutoPostBack="True" OnTextChanged="txtRDate_Te
xtChanged">
</asp:TextBox>
Javascript code is:
- <script type="text/javascript">
$('#test').datepicker({
dateFormat: 'yy/mm/dd',
minDate: new Date(2017, 1, 1),
defaultDate: new Date(),
onSelect: function(date, obj){
$('#txtRDate').val(date); //Updates value of date
$('#txtRDate').trigger('ch
ange');
}
});
</script>
when select date from datepicker the TextChanged for textbox fired and do postback.
c# Code behind:
- protected void txtRDate_TextChanged(objec
t sender, EventArgs e)
{
GetData(txtRDate.Text);
}
Kindly advise me how to keep datepicker with date value selected after auto postback event?
Thanks in Advance.