Data lost in the postback
<p>I need a way for a piece of data to presist across postbacks. Is there a way besides, cookies, and sessions?</p>

<p>I've got a listbox, when clicked, the selected index changed event takes a session which contains user id and feeds it to a method that fetches user's name, etc. Then I use FindControl method to locate a button inside the form view. I set the button's text property with data just fetched such as first and last name.</p>

<p>It works on the initial load, but if I click on other records in the listbox second time the text property is not set.</p>

<p>I did not write this code - I'm trying to make chages.</p>

<p>Here is the list box:</p>

<pre><code>&lt;asp:ListBox ID="lbxUpcommingEvents" runat="server" DataSourceID="odsUpcommingEvents" 
Rows="6" DataTextField="Title" DataValueField="id" AutoPostBack="true"
Width="206px" OnSelectedIndexChanged="lbxUpcommingEvents_OnSelectedIndexChanged"  /&gt;
</code></pre>

<p>Listbox'x on selected index changed:</p>

<pre><code>protected void lbxUpcommingEvents_OnSelectedIndexChanged(object sender, EventArgs e)
{
    pnlEventsSignUp.Visible = true;
    string _selectedItemValue = lbxUpcommingEvents.SelectedValue.ToString();

    LoadName();

}

protected void LoadName()
{
    MembershipUser user = Membership.GetUser();
    DataSetTableAdapters.MemberInfoTableAdapter da = new DataSetTableAdapters.MemberInfoTableAdapter();

    Guid _memberId = Guid.Empty;
    _memberId = new Guid(Session["myId"].ToString());
    DataSet.MemberInfoDataTable dt = da.GetMember(_memberId);
    if (dt.Rows.Count == 1)
    {
        DataSet.MemberInfoRow mr = dt[0];

        RolloverLink rlnkSignUp = (RolloverLink)(fvEventSignUp.FindControl("rlnkSignUp"));
        rlnkSignUp.Text = "I, " + mr.firstname + " " + mr.lastname + " will be attending this event.";
    }
}
</code></pre>

<p>Here is markup for the form view where I set the RolloverLinkButton's text property.</p>

<pre><code>&lt;asp:Panel runat="server" ID="pnlEventsSignUp" visible="false"&gt;
&lt;div class="dashedline" &gt;&lt;/div&gt;
&lt;asp:FormView ID="fvEventSignUp" runat="server" DataSourceID="SqlDataSource1" 
    DataKeyNames="id" Width="100%" &gt;
    &lt;ItemTemplate&gt;
        &lt;h2&gt;
            &lt;asp:Label Text='&lt;%# Eval("title") %&gt;' runat="server" ID="titleLabel" /&gt;
        &lt;/h2&gt;
        &lt;div class="itemdetails"&gt;
            &lt;br /&gt;
            location:
            &lt;h3&gt;
                &lt;asp:Label ID="locationLabel" runat="server" Text='&lt;%# ShowLocationLink(Eval("locationname"),Eval("location")) %&gt;' /&gt;
            &lt;/h3&gt;
            &lt;p&gt;
                &lt;asp:Label Text='&lt;%# Eval("starttime","{0:D}") %&gt;' runat="server" ID="itemdateLabel" CssClass="GeneralText" /&gt;

                &lt;asp:Label Text='&lt;%# ShowDuration(Eval("starttime"),Eval("endtime")) %&gt;' runat="server" ID="Label1"  CssClass="GeneralText" /&gt;
            &lt;/p&gt;
        &lt;/div&gt;
        &lt;div class="downloadevent"&gt;
            &lt;a href="#"&gt;
                &lt;img src="images/icon_download_event.gif" alt="Download this event to your personal calendar"
                    width="15" height="26" /&gt;&lt;/a&gt;&lt;a href='&lt;%# "events_download.ashx?EventID=" + Convert.ToString(Eval("id")) %&gt;'&gt;Add
                        this event to your personal calendar&lt;/a&gt;
        &lt;/div&gt;
        &lt;Club:ImageThumbnail ID="thumb1" runat="server" ImageSize="Large" PhotoID='&lt;%# Eval("photo") %&gt;' /&gt;
        &lt;p&gt;
            &lt;asp:Label Text='&lt;%# Eval("description") %&gt;' runat="server" ID="descriptionLabel" /&gt;
        &lt;/p&gt;
        &lt;div class="dashedline" &gt;&lt;/div&gt;
        &lt;asp:Panel ID="panel1" runat="server" CssClass="actionbuttons" Visible='&lt;%#User.IsInRole("Administrators") %&gt;'&gt;
            &lt;table border="0" cellpadding="2" cellspacing="2"&gt;
                &lt;tr&gt;
                    &lt;td&gt;
                        &lt;asp:Label runat="server" ID="Label2" Text="Action&lt;br /&gt;Required" Width="80px" /&gt;
                    &lt;/td&gt;
                    &lt;td&gt;
                        &lt;img src="images/RedArrow.jpg" alt="Red Arrow Right" /&gt;
                    &lt;/td&gt;
                    &lt;td&gt;
                        &lt;asp:CheckBox runat="server" ID="cbxCert" Height="30px" Text="Check to Confirm Attendance" /&gt;&lt;br /&gt;
                        &lt;asp:CustomValidator runat="server" ID="rfvConfirm" 
                                    ErrorMessage="You must check the box to continue" Font-Bold="true"
                                    ForeColor="#cc0000" ClientValidationFunction="ensureChecked" /&gt; &lt;br /&gt;
                        &lt;Club:RolloverLink ID="rlnkSignUp" runat="server"
                        /&gt;
                    &lt;/td&gt;
                &lt;/tr&gt;
            &lt;/table&gt;                    
        &lt;/asp:Panel&gt;
    &lt;/ItemTemplate&gt;
&lt;/asp:FormView&gt;
&lt;/asp:Panel&gt;
</code></pre>
