I have an ASP Page that uses two listboxes and a third party control (Fluent.ListTransfer) to transfer values from one list to the other. Fairly standard stuff:
<td>
<asp:ListBox ID="ListBoxAvailable" Runat="server"
SelectionMode="Multiple" EnableViewState="true">
</asp:ListBox>
</td>
<td style="vertical-align: middle">
<a href="#" onclick="<%= ListTransfer1.ClientMoveSelected %>" ><img src="img/RightArrow.jpg" alt=">>"/></a>
<br />
<a href="#" onclick="<%= ListTransfer1.ClientMoveBackSelected %>"><img src="img/LeftArrow.jpg" alt="<<"/></a>
</td>
<td>
<asp:ListBox ID="ListBoxSelected" Runat="server"
SelectionMode="Multiple" EnableViewState="true">
</asp:ListBox>
</td>
On the Controls Page_load event, I set the content of the 'available' and 'selected' box with some sql:
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack)
return;
// Some code to work through a recordset, adding values
// to the selected or available list boxes
I assumed that on postbacks, the viewstate would take care of the state of listboxes, as changed by the user (after all, they are standard ASP controls). However, both list boxes are blank if I do a postback.
What's the proper way to maintain the state of the listboxes between postbacks?
Thanks for any help
Ryan