I need to save the choice of the user.. did it this way:
$(".dateTimeFilterIdentifierCls").change(function () {
debugger;
localStorage.setItem('ChosenDateIndexLS', $(".dateTimeFilterIdentifierCls").find(":selected")[0].index);
});
$(document).ready(function () {
console.log("ChosenDateIndexLS is :: ", localStorage.getItem('ChosenDateIndexLS'));
$(".dateTimeFilterIdentifierCls").prop('selectedIndex', localStorage.getItem('ChosenDateIndexLS'));
});
used css class in the aspx page:
<td height="21" width="343" colspan="2" style="width: 614px;">
<asp:UpdatePanel ID="showsDatalistPanel" runat="server" Visible="false" UpdateMode="Always">
<ContentTemplate>
<div>
<asp:DropDownList ID="dateTimeFilter" CssClass="dateTimeFilterIdentifierCls" runat="server" OnSelectedIndexChanged="dateTimeFilter_SelectedIndexChanged"
onchange="bindControlEvents()" AutoPostBack="true" Visible="false">
</asp:DropDownList>
<label id="dateTimeFilterLabel" runat="server" style="padding-left: 15px" visible="false">
בחירת מופע לפי תאריך</label>
</div>
Also tried to save the index with:
$(".dateTimeFilterIdentifierCls").change(function () {
localStorage.setItem('ChosenDateIndexLS', $(".dateTimeFilterIdentifierCls").val());
});
non of them work. really need a solution. Thanks!