Hi,.
I am about to update an application to use the Radlistbox, where I currently use the ASP.NET Listbox.
I have 2 listboxes, where the 1st contains values, that can be transferred to the 2nd.
- BUT the 2nd has already some preselected, and if the values are in the 2nd listbox, they should NOT be in the 1st Listbox.
VERY simple, and no problem when I use the classic listboxes.
But how is this done in Radlistboxes?
This is quite simple, but I couldn't find the answer in this forum.
See my example script:
HTML:
And the VB-script:
This VB dos not work:
If Not Me.listSelectedwebsites.Items.Contains(New RadListBoxItem("RadListBoxItem1", 1)) Then
- I want to check if the value is in the 2nd listbox - if not I put it in the 1st listbox.
But I have no luck.
Hope someone can help?
Thanks.
Br
Frank
I am about to update an application to use the Radlistbox, where I currently use the ASP.NET Listbox.
I have 2 listboxes, where the 1st contains values, that can be transferred to the 2nd.
- BUT the 2nd has already some preselected, and if the values are in the 2nd listbox, they should NOT be in the 1st Listbox.
VERY simple, and no problem when I use the classic listboxes.
But how is this done in Radlistboxes?
This is quite simple, but I couldn't find the answer in this forum.
See my example script:
HTML:
<form id="form1" runat="server"> |
<div> |
<telerik:RadScriptManager ID="RadScriptManager1" Runat="server"> |
</telerik:RadScriptManager> |
hello</div> |
<div class="radtxt"> |
<div style="float: left;"> |
<div> |
All Websites:</div> |
<telerik:RadListBox ID="listWebsites" runat="server" Width="180px" |
Height="200px" TransferToID="listSelectedwebsites" |
Skin="Telerik" /> |
</div> |
<div style="float: left;"> |
<div style="vertical-align: middle; text-align: center;"> |
<asp:Button ID="btnTransferright" CssClass="specialbuttons" OnClientClick="return transferRight()" |
Text="Add >>" runat="server" /> |
</div> |
<div> |
<asp:Button ID="btnTransferleft" CssClass="specialbuttons" OnClientClick="return transferLeft()" |
Text="<< Remove" runat="server" /> |
</div> |
</div> |
<div style="float: left;"> |
<div> |
Selected Website(s):</div> |
<telerik:RadListBox ID="listSelectedwebsites" runat="server" Width="180" Height="200px" |
Skin="Telerik" /> |
</div> |
</div> |
</form> |
And the VB-script:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load |
Me.listSelectedwebsites.Items.Add(New RadListBoxItem("RadListBoxItem1", 1)) |
'Me.listSelectedwebsites.Items.Add(New RadListBoxItem("RadListBoxItem2", 2)) |
Me.listSelectedwebsites.Items.Add(New RadListBoxItem("RadListBoxItem3", 3)) |
If Not Me.listSelectedwebsites.Items.Contains(New RadListBoxItem("RadListBoxItem1", 1)) Then |
Me.listWebsites.Items.Add(New RadListBoxItem("RadListBoxItem11", 11)) |
End If |
If Not Me.listSelectedwebsites.Items.Contains(New RadListBoxItem("RadListBoxItem2", 2)) Then |
Me.listWebsites.Items.Add(New RadListBoxItem("RadListBoxItem22", 22)) |
End If |
If Not Me.listSelectedwebsites.Items.Contains(New RadListBoxItem("RadListBoxItem3", 3)) Then |
Me.listWebsites.Items.Add(New RadListBoxItem("RadListBoxItem33", 33)) |
End If |
End Sub |
This VB dos not work:
If Not Me.listSelectedwebsites.Items.Contains(New RadListBoxItem("RadListBoxItem1", 1)) Then
- I want to check if the value is in the 2nd listbox - if not I put it in the 1st listbox.
But I have no luck.
Hope someone can help?
Thanks.
Br
Frank