Preface: First time really using JavaScript + jQuery, so my problem likely stems from a lack of understanding.
I have some very simple Javascript to move elements from one ListBox to another:
$('[id$=AddRole]').click(function () {
$('[id$=MissingRoles] option:selected').appendTo('[id$=Roles]');
return false;
});
$('[id$=RemoveRole]').click(function () {
$('[id$=Roles] option:selected').appendTo('[id$=MissingRoles]');
return false;
});
This works wonderfully - when I click a button, the items in one list move to the other as you would expect. Fantastic! A button is then clicked forcing a Postback. In the if (IsPostBack) section of my code, I extract the 'Roles' ItemCollection and print each item out, assuming to see any new items I added. Sadly, I only get the original items that were DataBound to the list. I don't have my DataBind accidently in the IsPostBack section, so I know I'm not simply re-binding.
I'm assuming I'm missing a step here. Is there something I need to do to tell .NET to actually update the contents of the ListBox? Guessing that whatever jQuery is doing is purely aesthetic, but I'm at a loss on how to commit its changes to my controls.