title: Settings values to Session Variable from Javascript
body: <p>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:</p>
  
  <pre><code>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
  </code></pre>
  
  <p><p>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:</p>
  
  <pre><code> &lt;script&gt;
          function SaveToHiddenField() {
              if ($("input:radio:checked").length &gt; 0) {
                  $radio = $("input:radio:checked");
                  document.getElementById('&lt;%= hdnField.ClientID %&gt;').value = $radio.val();
                  &lt;% Session["Slot"] = hdnField.Value; %&gt;
                  window.location.href='default2.aspx'
                  return true;
              }
              else {
                  alert("Nothing Selected");
                  return false;
              }
          }
      &lt;/script&gt;
  
  &lt;asp:Button ID="btnSession" runat="server" Text="Save to Session" OnClientClick="return SaveToHiddenField()" /&gt;
  &lt;asp:HiddenField ID="hdnField" runat="server" /&gt;
  </code></pre>
  
  <p>Can anyone tell me whats wrong i am doing, or any other alternative which could be the better option for my query.</p>