title: Retrieve Selected Checkbox Value From Previous Page
body: <p>I have an <code>asp.net webform</code> website which stores data in a session and on the 3rd page displays the entries entered on pg1 &amp; pg2.</p>
  
  <p>On the first page the first checkboxes is pre-selected by default but if the user selects/unselects a checkbox, when the user is on the second page, there is a back button but when it's clicked I don't know how to re-show the checkboxes selected/unselected as only the default one is checked.</p>
  
  <p>I'm new to using ASP and session storing so I may be doing something completely wrong. How can I resolve my situation?</p>
  
  <p>My code is:</p>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;div class="form-group"&gt;
       &lt;div class="col-xs-offset-0 col-sm-offset-4 col-sm-3"&gt;All services&lt;/div&gt;
       &lt;div class="col-sm-1"&gt;
            &lt;asp:CheckBox ID="Step02AllServices" runat="server" Checked="True" /&gt;
       &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="form-group"&gt;
       &lt;div class="col-xs-offset-0 col-sm-offset-4 col-sm-3"&gt;Site content uploading only&lt;/div&gt;
       &lt;div class="col-sm-1"&gt;
            &lt;asp:CheckBox ID="Step02ContentUploading" runat="server" /&gt;
       &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="form-group"&gt;
       &lt;div class="col-xs-offset-0 col-sm-offset-4 col-sm-3"&gt;Site content &amp;amp; layout checking&lt;/div&gt;
       &lt;div class="col-sm-1"&gt;
            &lt;asp:CheckBox ID="Step02ContentLayoutChecking" runat="server" Enabled="False" /&gt;
       &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>Code Behind</strong></p>
  
  <pre><code>protected void Step02SubmitButton_Click(object sender, EventArgs e)
  {
       Session["Step02AllServices"] = Step02AllServices.Checked;
       Session["Step02ContentUploading"] = Step02ContentUploading.Checked;
       Session["Step02ContentLayoutChecking"] = Step02ContentLayoutChecking.Checked;
       Response.Redirect("/Quotation/pg3.aspx");
  }
  </code></pre>
  
  <p>I know that is needs to be in my <code>Page_Load</code> just not sure how to do it.</p>
  
  <p>The below is what I have for radio buttons and test fields on another page</p>
  
  <pre><code>if (txtData2.Text == string.Empty &amp;&amp; Session["pg2"] != null)
  {
       txtData2.Text = Session["pg2"].ToString();
  
       if (Session["pg2Yes"].ToString() == "Yes")
       {
            pg2Yes.Checked = Session["pg2Yes"].Equals("Yes");
       }
  
       if (Session["pg2No"].ToString() == "No")
       {
            pg2No.Checked = Session["pg2No"].Equals("No");
       }
  }
  </code></pre>