If you are not so familiar with Ajax, or just not using it, it could be nice to know Javascripting.
I had to extract a value from a listbox and put it into a textbox, also I wanted to keep the selectedvalue somewhere.
This is how I did it:
ListBox1.Attributes.Add("onclick", "javascript:var w = " + ListBox1.ClientID + ".selectedIndex;
" + txtDepartment.ClientID + ".value = " + ListBox1.ClientID + ".options[w].text;
" + selItem.ClientID + ".value=" + ListBox1.ClientID + ".value");
You can go even further, when you want a Text in the listbox and 2 values, you can use string concatination in Javascript. This is a little more complicated, but still easy programming. In the following code I get the values from the listbox, seperate them and set the selected item of a dropdown and the value of a hidden field! In .Net always use the clientID property, because the name of the field depends on where the field is on.
script = "javascript:arrres= " + ListBox1.ClientID + ".value.split('*');";
script += selItem.ClientID + ".value=arrres[0];";
script += drpUserRoles.ClientID + ".value = arrres[1];";
ListBox1.Attributes.Add("onclick", script);
I'm not using Ajax for this project, so maybe there will be some more javascript posts in the near future.