Hi,
I have a RadListBox to which I add items using client-side code.
The RadListBox has default SelectionMode, which is "Single".
After I add an item I want that item to be selected.
What happens is that the newly added item is indeed selected but any other already selected item remains selected resulting in multiple selected items which should ot happen. I even explicitly call clearSelection() prior to selecting the newly added item.
Here is a code smaple:
Am I doing something wrong? Or is it incorrect behaviour of the RadListBox?
Regards,
Mink
I have a RadListBox to which I add items using client-side code.
The RadListBox has default SelectionMode, which is "Single".
After I add an item I want that item to be selected.
What happens is that the newly added item is indeed selected but any other already selected item remains selected resulting in multiple selected items which should ot happen. I even explicitly call clearSelection() prior to selecting the newly added item.
Here is a code smaple:
<html xmlns="http://www.w3.org/1999/xhtml" > |
<head runat="server"> |
<title></title> |
</head> |
<body> |
<form id="form1" runat="server"> |
<asp:ScriptManager ID="ScriptManager1" runat="server" /> |
<div style="height:300px; width:200px; float:left;"> |
<telerik:RadListBox ID="RadListBox1" runat="server" Height="100%" Width="100%" SelectionMode="Single"> |
<Items> |
<telerik:RadListBoxItem Text="bla" /> |
<telerik:RadListBoxItem Text="lala" /> |
<telerik:RadListBoxItem Text="qwerty" /> |
</Items> |
</telerik:RadListBox> |
</div> |
<div style="float:left;"> |
<asp:Button ID="Button2" runat="server" Text="Add" OnClientClick="Add(); return false;" /> |
</div> |
</form> |
<script type="text/javascript"> |
function Add() { |
var rbl = $find("<%= RadListBox1.ClientID %>"); |
var item = new Telerik.Web.UI.RadListBoxItem(); |
item.set_text('pomptidom'); |
rbl.get_items().insert(0, item); |
rbl.clearSelection(); |
item.select(); |
} |
</script> |
</body> |
</html> |
Am I doing something wrong? Or is it incorrect behaviour of the RadListBox?
Regards,
Mink