Ok I just want to know if what I am thinking of is even possible. I have tried researching but was not able to find anything. I have two RadLsitBox that I can transfer data between. I want to know if I could add an Undo button that could undo the last transfer I make.
FYI Client wants an undo button. I do not think this is possible to pass items only through code without pressing the buttons but if someone has a way I would like to hear.
<telerik:RadListBox ID="rlbStations" runat="server" AllowTransfer="True" TransferToID="rlbAllowedStations"
Height="200px" Skin="Web20" SelectionMode="Multiple" Sort="Ascending" DataKeyField="station_id"
AutoPostBackOnTransfer="true" Width="250px" OnTransferred="rlbStations_Transferred">
<ButtonSettings ShowDelete="False" ShowReorder="False" />
</telerik:RadListBox>
<telerik:RadListBox ID="rlbAllowedStations" runat="server" Height="200px" Width="250px"
Skin="Web20">
</telerik:RadListBox>
EDIT: Add javascript
var UndoList = new Array();
function onClientTransferring(sender, e) {
var items = e.get_items();
for (var i = 0; i < items.length; i++) {
var item = items[i];
if (item.get_text() != "Select" || item.get_value() != "") {
UndoList.push(item);
UndoList.push(e.get_sourceListBox());
UndoList.push(e.get_destinationListBox());
sender.transferItem(item, e.get_sourceListBox(),e.get_destinationListBox());
}
}
}
function undoChanges() {
if (UndoList[UndoList.length - 1]._clientStateFieldID == "rlbStations_ClientState") {
var listbox = $find('rlbStations');
}
else if (UndoList[UndoList.length - 1]._clientStateFieldID == "rlbAllowedStations_ClientState") {
var listbox = $find('rlbAllowedStations');
}
listbox.transferItem(UndoList[UndoList.length - 3], UndoList[UndoList.length - 2], UndoList[UndoList.length - 1]);
}