I have a shopping cart, for the Time Slot selection for product delivery i want to display Date for the next one week, First Column(Per Day in Per Row), and TimeSlots in another column, the format like 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 with radiobuttonlist (for Time Slots), but the problem is user is able to select Time for Every Days. So as an alternative i am trying to check the TimeSlot selected at the javascript end and because i want the Slot accessible for next checkout wizard, i want to store the selected time slot in the session. I am able to validate the Time Slot if not selected, and get the value in the alert, if selected. However when i try to save the value to session from hidden field (saved on button click at client end), i am not getting the session value to other pages. Below is the code i am 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 to Session" OnClientClick="return SaveToHiddenField()" />
<asp:HiddenField ID="hdnField" runat="server" />
Can anyone tell me whats wrong i am doing, or any other alternative which could be the better option for my query.