title: Access control's dynamic data after postback
body: <p>So I have a cascading dropdown of sorts, but using List Boxes. When an item is selected in the first ListBox, the second ListBox is populated with items based on the first selection (this is done using a jQuery AJAX call). Here's what I got:</p>
  
  <pre><code>$('#&lt;%= lbEvents.ClientID %&gt;').change(function() {
      var selectedValues = $('#&lt;%= lbEvents.ClientID %&gt;').val();
      var json = '{ events: [' + selectedValues.join(',') + '] }';
  
      $.ajax({
          type: "POST",
          url: 'Default.aspx/PopulateAttendees',
          data: json,
          contentType: "application/json; charset=utf-8",
          dataType: "json",
          success: OnAttendeesPopulated
      });
  });
  
  
  
  function OnAttendeesPopulated(response) {
      var attendees = response.d;
      var attendeesList = $("#&lt;%= lbAttendees.ClientID %&gt;");
  
      attendeesList.children().remove();
  
      $.each(attendees, function() {
          attendeesList.append($("&lt;option&gt;&lt;/option&gt;").val(this['Value']).html(this['Text']));
      });
  }
  
  
  //Populated on PageLoad
  &lt;asp:ListBox ID="lbEvents" runat="server" SelectionMode="Multiple" /&gt;
  
  &lt;asp:ListBox ID="lbAttendees" runat="server" SelectionMode="Multiple" /&gt;
  
  &lt;asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClick="btnSubmit_Click" /&gt;
  </code></pre>
  
  <p>At first, I was getting an error on the button's click event because lbAttendees was being loaded dynamically, so I had to set EnableEventValidation to false.</p>
  
  <p>I don't get the error now, but in the button's click event, I can only access the data in lbEvents, but not lbAttendees; lbAttendees is empty in the click event. I assume I need to store the data from lbAttendees in ViewState.</p>
  
  <p>How can I store the data from lbAttendees in ViewState so I can access it in the click event?</p>