After some action (ComboBoxSelectedItemChange) it throws the Console Error: Source and destination listbox can't be the same.
I try to fix and understand the problem, but I can't. Please, help as fast as possible!
Here is my used telerik components and their properties:
It's my RadListBox methods:
I try to fix and understand the problem, but I can't. Please, help as fast as possible!
Here is my used telerik components and their properties:
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"RadListBoxADGroups"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadListBoxGroups"
/>
<
telerik:AjaxUpdatedControl
ControlID
=
"LabelMessage"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
<
telerik:AjaxSetting
AjaxControlID
=
"RadListBoxGroups"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"LabelMessage"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
<
telerik:AjaxSetting
AjaxControlID
=
"RadComboBoxPolice"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadListBoxGroups"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
<
table
>
<
tr
>
<
td
>
<
telerik:RadListBox
ID
=
"RadListBoxADGroups"
runat
=
"server"
AllowTransfer
=
"True"
DataSourceID
=
"ObjectDataSourceADGroup"
DataTextField
=
"Name"
Height
=
"300px"
Width
=
"300px"
TransferToID
=
"RadListBoxGroups"
EmptyMessage
=
"Active Directory is missing"
AutoPostBackOnTransfer
=
"True"
OnTransferred
=
"RadListBoxADGroupsTransferred"
EnableDragAndDrop
=
"True"
TransferMode
=
"Copy"
>
<
ButtonSettings
TransferButtons
=
"TransferFrom"
Position
=
"Right"
VerticalAlign
=
"Top"
AreaWidth
=
"40"
/>
</
telerik:RadListBox
>
<
asp:ObjectDataSource
ID
=
"ObjectDataSourceADGroup"
runat
=
"server"
SelectMethod
=
"SelectADGroups"
TypeName
=
"Scheduler.WebClient.ADGroup"
></
asp:ObjectDataSource
>
</
td
>
<
td
>
<
telerik:RadListBox
ID
=
"RadListBoxGroups"
runat
=
"server"
EmptyMessage
=
"No Sorted Groups"
Style
=
"top: 0px; left: 0px; width: 250px; height: 300px"
Height
=
"300px"
AutoPostBackOnDelete
=
"True"
DataKeyField
=
"GroupPoliceId"
DataSourceID
=
"ObjectDataSourceFiltGroups"
DataTextField
=
"Name"
DataValueField
=
"Id"
OnDeleted
=
"RadListBoxGroupsDeleted"
AllowDelete
=
"True"
OnClientDeleting
=
"RadListBoxGroups_Deleting"
>
<
ButtonSettings
Position
=
"Right"
VerticalAlign
=
"Top"
AreaWidth
=
"40"
/>
</
telerik:RadListBox
>
<
asp:ObjectDataSource
ID
=
"ObjectDataSourceFiltGroups"
runat
=
"server"
SelectMethod
=
"SelectFilteredGroups"
TypeName
=
"Scheduler.WebClient.Controller"
>
<
SelectParameters
>
<
asp:ControlParameter
ControlID
=
"RadComboBoxPolice"
Name
=
"politicId"
PropertyName
=
"SelectedValue"
Type
=
"Int32"
/>
<
asp:ControlParameter
ControlID
=
"LabelOwnGName"
Name
=
"ownGName"
PropertyName
=
"Text"
Type
=
"String"
/>
</
SelectParameters
>
</
asp:ObjectDataSource
>
</
td
>
</
tr
>
<
tr
>
<
td
>
<
asp:Label
ID
=
"LabelOwnGName"
runat
=
"server"
/>
<
asp:ObjectDataSource
ID
=
"ObjectDataSourceGrPolices"
runat
=
"server"
SelectMethod
=
"SelectGroupPolices"
TypeName
=
"Scheduler.WebClient.Controller"
></
asp:ObjectDataSource
>
</
td
>
<
td
>
<
telerik:RadComboBox
ID
=
"RadComboBoxPolice"
runat
=
"server"
DataSourceID
=
"ObjectDataSourceGrPolices"
DataTextField
=
"Name"
DataValueField
=
"Id"
AutoPostBack
=
"True"
Width
=
"100px"
>
</
telerik:RadComboBox
>
</
td
>
</
tr
>
</
table
>
</
div
>
<
br
/>
<
div
class
=
"field-center-error"
>
<
asp:Label
ID
=
"LabelMessage"
runat
=
"server"
ClientIDMode
=
"Static"
/>
</
div
>
It's my RadListBox methods:
protected void RadListBoxADGroupsTransferred(object sender, Telerik.Web.UI.RadListBoxTransferredEventArgs e)
{
if (e.DestinationListBox != sender)
{
foreach (var grpIns in e.Items.Select(item => new Group { Name = item.Text,
GroupPoliceId = Convert.ToInt32(RadComboBoxPolice.SelectedValue) }) )
{
_sc.InsertGroup(grpIns);
}
LabelMessage.Text = Controller.Message;
RadListBoxGroups.DataBind();
}
}
protected void RadListBoxGroupsDeleted(object sender, Telerik.Web.UI.RadListBoxEventArgs e)
{
foreach (var grpDel in e.Items.Select(item => new Group { Id = Convert.ToInt32(item.Value),
Name = item.Text }))
{
_sc.DeleteGroup(grpDel);
}
LabelMessage.Text = Controller.Message;
RadListBoxGroups.DataBind();
}