HI,
Use the function given below in java script it will works for u...
function MoveItem(lstass ociatedstate, lstavailablesta te,f,v)
{
var hid;
var id=v;
hid = '';
if(id=="ctl00_C ontentPlaceHold er1_TabAddCompa ny_TabPanel1_bt nnextone")
{
if ((lstavailables tate != null) && (lstassociateds tate != null))
{
if(lstavailable state.length < 1)
{
alert('There are no items in the source ListBox');
return false;
}
if(lstavailable state.options.s electedIndex == -1) // when no Item is selected the index will be -1
{
alert('Please select an Item to move');
return false;
}
while ( lstavailablesta te.options.sele ctedIndex >= 0 ) {
var newOption = new Option(); // Create a new instance of ListItem
newOption.text = lstavailablesta te.options[lstavailablesta te.options.sele ctedIndex].text;
newOption.value = lstavailablesta te.options[lstavailablesta te.options.sele ctedIndex].value;
lstassociatedst ate.options[lstassociatedst ate.length] = newOption; //Append the item in Target
hid = hid + lstavailablesta te.options[lstavailablesta te.options.sele ctedIndex].value + ",";
lstavailablesta te.remove(lstav ailablestate.op tions.selectedI ndex); //Remove the item from Source
}
}
}
}
Comment