I have (1) dropdown list, (2) listboxes, (1) button on a page.
The listboxes start out empty, but it is filled via jquery/ajax on the dropdown list change.
When i click the button it causes a postback and every time it does the contents (options) within the listboxes are removed.
Questions:
1) WHY does this happen?
2) HOW do i keep the contents of the listbox from being removed? No options in the listboxes are selected
The
content/state of form controls are stored in view statethat is created on server side by asp.net engine. The elements added on client wont be accessible on server side. You can put the content data in the hidden field in javascript and get the data back on server side from the hidden field and assign to control like listbox, dropdown etc.This is how asp.net also works.