Storing and Setting Expanded property on dynamically created Collapsible blocks

Storing and Setting Expanded property on dynamically created Collapsible blocks

I have a page that is dynamically creating Collapsible blocks from a dataset.  Depending on the results returned, the page can create 0 to many collapsible blocks.  The Dataset contains 2 Datatables, Table(0) contains the value for the Collapsible Blocks header, and the data to be displayed within the Collapsible block lives in Table(1).
 
The code looks something like this:
 
<% For x = 0 to myDatatable.Tables(0).Rows.Count - 1 %>
    <div data-role="collapsible" data-mini="true" data-theme="a">
          <h3><%=myDatatable.Tables(0).Rows(x)("myValue")%></h3>
          <p>
              CODE HERE fills the contents of the block with the contents of myDatatable.Tables(1) based on  its relation to Tables(0)
          </p>
    </div>
 
OK - so that all works fine - and I get the appropriate Collapsible blocks.  The above is all wrapped in another IF that makes sure there is data to display, and if not it doesn't create any collapsible blocks and displays a message that there is no data to display.
 
The problem comes in when the page gets posted back to itself.  The page contains "post-back" buttons that reload the page passing different parameters to the procedure that fills myDatatable.  When this happens, the Collapsible blocks are recreated - and there may now be more or fewer than there were before.
 
My challenge is this - if a Collapsible Block existed before postback - and if it had been expanded - then when the page is redisplayed I want it to still be expanded.
 
The value that is being displayed in the <h3> from Table(0) is a state name - so depending on which button on the page is pressed there could be Collapsible Blocks for different states.  But if I currently have a Block displaying data for Alabama for example, and I click a button to pull new data, and the newly reloaded page also contains data for Alabama and has a Collapsible Block for Alabama, then I want it to be expanded on load.
 
Since the Blocks are all dynamically created, and since the number of blocks can chage, I am having a hard time sorting out how to give them dynamically created IDs and then use these with the "collapse" and "expand" events to store which ones are expanded so if they still exist after a postback, they stay expanded.
 
Does this make sense at all?  Anyone have any insight on this?
 
TIA!