ASP.NET uses a mechanism called ViewState to "remember" control values between postbacks. This state is stored in a hidden field in the page, and processed each time the form is posted. That's why you get the listboxes (loaded on the server-side) rendered automatically with all the items. But only the ViewState is posted back, together with the current value of form controls. As you're loading these values on the client-side, the __VIEWSTATE hidden field doesn't contain any information about it, and so they are lost when the form comes back.
Dig Deeper on Win Development Resources
Related Q&A from Daniel Cazzulino
Here Daniel Cazzulino explains how to load a DSL (domain specific language) domain model instance file programmatically. This requires the .NET type ... Continue Reading
Here we offer a glimpse at 12 of .NET development expert Danny Cazzulino's top ASP.NET questions and answers. Continue Reading
C# developers should NOT be modifying InitializeComponent method in the code-behind (or any of the variable definitions) by hand. Continue Reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.