<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ListBoxesFT_C.ascx.cs" Inherits="UserControls_ListBoxesFT_C" %>
place the following script:
<script language="javascript" type="text/javascript">
// <!CDATA[
function ButtonHTML_onclick(ListBoxFrom,ListBoxTo,
HiddenToText,HiddenToValue,
HiddenFromText,HiddenFromValue,
bOrderByText,bDoFromList)
{
var iOption;
var iCountHelp;
var iItemList;
var iItemSelect;
var sHelp ;
var iHelp ;
var sForSplit = ":";
var arrList = Array();
var arrListHelp = Array();
var arrHelp = Array();
var sListFrom;
var sListTo;
if (typeof(bDoFromList)== "undefined")
{
bDoFromList=true;
}
else
{
if (typeof(bDoFromList)!= "boolean")
{
bDoFromList=true;
};
};
if (bDoFromList)
{
sListFrom="ListBoxFrom";
sListTo="ListBoxTo";
}
else
{
sListFrom = "ListBoxTo";
sListTo = "ListBoxFrom";
};
if (typeof(bOrderByText )== "undefined")
{
bOrderByText=true;
}
else
{
if (typeof(bOrderByText )!= "boolean")
{
bOrderByText=true;
};
};
iCountHelp=0;
eval("iItemList=" + sListFrom + ".length");
for(iOption=0;iOption< iItemList;iOption++)
{
if (eval(sListFrom+".options[iOption-iCountHelp].selected"))
{
eval("sHelp="+sListFrom+".item(iOption-iCountHelp).text");
eval("iHelp="+sListFrom+".item(iOption-iCountHelp).value");
eval(sListFrom+".remove(iOption-iCountHelp)");
iCountHelp=iCountHelp+1;
eval(sListTo +".options["+sListTo+".length]= new Option(sHelp,iHelp)");
};
};
eval("iItemSelect=" + sListTo+ ".length");
for(iCountHelp=0;iCountHelp<iItemSelect; iCountHelp++)
{
eval("sHelp="+sListTo+".item(iCountHelp).text");
eval("iHelp="+sListTo+".item(iCountHelp).value");
if (bOrderByText)
{
arrList[iCountHelp]= sHelp + sForSplit + iHelp;
}
else
{
arrList[iCountHelp]= iHelp + sForSplit + sHelp;
};
};
arrList = arrList.sort();
for(iCountHelp=0;iCountHelp<iItemSelect; iCountHelp++)
{
arrHelp= arrList[iCountHelp].split(sForSplit);
if (bOrderByText)
{
sHelp=arrHelp[0];
iHelp=arrHelp[1];
}
else
{
sHelp=arrHelp[1];
iHelp=arrHelp[0];
};
eval(sListTo +".item(iCountHelp).text=sHelp ");
eval(sListTo +".item(iCountHelp).value=iHelp");
};
fillHidden(ListBoxFrom,HiddenFromText,HiddenFromValue);
fillHidden(ListBoxTo,HiddenToText,HiddenToValue);
}
//---------------------------------------------------------
function fillHidden (ListBox,HiddenText,HiddenValue)
{
var iOption;
var sHelp = "";
var iHelp= "";
var sHiddenText = "";
var sHiddenValue = "";
iOption= ListBox.length;
hiddenClear(HiddenText,HiddenValue);
for (var i=0 ;i<iOption; i++)
{
sHelp=ListBox.item(i).text;
iHelp=ListBox.item(i).value;
sHiddenText = sHiddenText + sHelp ;
sHiddenValue = sHiddenValue + iHelp;
if (i != iOption - 1)
{
sHiddenText = sHiddenText + ",";
sHiddenValue = sHiddenValue + ",";
};
};
HiddenText.value = sHiddenText;
HiddenValue.value = sHiddenValue;
}
//-------------------------------------------------------
function hiddenClear(HiddenText,HiddenValue)
{
HiddenText.value = "";
HiddenValue.value = "";
}
// ]]>
</script>