jquery - Settings values to Session Variable from Javascript -
i have shopping cart, time slot selection product delivery want display date next 1 week, first column(per day in per row), , timeslots in column, format below:
column1 column2 aug 19, 2013 [radiobutton]10:00am [radiobutton]12:00pm aug 20, 2013 [radiobutton]10:00am [radiobutton]12:00pm aug 21, 2013 [radiobutton]10:00am [radiobutton]12:00pm aug 22, 2013 [radiobutton]10:00am [radiobutton]12:00pm aug 23, 2013 [radiobutton]10:00am [radiobutton]12:00pm aug 24, 2013 [radiobutton]10:00am [radiobutton]12:00pm aug 25, 2013 [radiobutton]10:00am [radiobutton]12:00pm
i tried using gridview radiobuttonlist (for time slots), problem user able select time every days. alternative trying check timeslot selected @ javascript end , because want slot accessible next checkout wizard, want store selected time slot in session. able validate time slot if not selected, , value in alert, if selected. when try save value session hidden field (saved on button click @ client end), not getting session value other pages. below code trying:
<script> function savetohiddenfield() { if ($("input:radio:checked").length > 0) { $radio = $("input:radio:checked"); document.getelementbyid('<%= hdnfield.clientid %>').value = $radio.val(); <% session["slot"] = hdnfield.value; %> window.location.href='default2.aspx' return true; } else { alert("nothing selected"); return false; } } </script> <asp:button id="btnsession" runat="server" text="save session" onclientclick="return savetohiddenfield()" /> <asp:hiddenfield id="hdnfield" runat="server" />
can tell me whats wrong doing, or other alternative better option query.
issue resolved, on button click wrote below code:
session["slot"] = hdnfield.value; response.redirect("default2.aspx");
now when page redirect default2.aspx, have session value.
thanks everyone,
specially @jasonp.
Comments
Post a Comment