Hi,
I have a RadListbox (single select mode) and a button which deselects all items in the RadListbox using clearSelection() in javascript. This appears to work, until there is a postback at which point the item is selected again.
Here is some example code which exhibits this problem
Is this a bug, or am I just missing something else that I need to do? I've seen trackChanges and commitChanges in the documentation but these seem to be needed only when adding or deleting ListItems clientside.
Thanks
Andy
I have a RadListbox (single select mode) and a button which deselects all items in the RadListbox using clearSelection() in javascript. This appears to work, until there is a postback at which point the item is selected again.
Here is some example code which exhibits this problem
(p_Postback_Click is just an empty event handler to cause a postback):
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestClearSelection.aspx.cs" Inherits="TestClearSelection" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
head
runat
=
"server"
>
<
title
></
title
>
</
head
>
<
body
>
<
form
id
=
"form1"
runat
=
"server"
>
<
script
type
=
"text/javascript"
>
function ClearListbox() {
lb = $find("RadListBox1");
lb.clearSelection();
}
</
script
>
<
ajax:ScriptManager
ID
=
"ScriptManager1"
runat
=
"server"
EnablePageMethods
=
"true"
></
ajax:ScriptManager
>
<
div
>
<
telerik:RadListBox
ID
=
"RadListBox1"
runat
=
"server"
>
<
Items
>
<
telerik:RadListBoxItem
Text
=
"Item 1"
/>
<
telerik:RadListBoxItem
Text
=
"Item 2"
/>
<
telerik:RadListBoxItem
Text
=
"Item 3"
/>
</
Items
>
</
telerik:RadListBox
>
<
asp:Button
ID
=
"b_ClearSelection"
runat
=
"server"
Text
=
"Clear Selection"
onclientclick
=
"ClearListbox(); return false;"
/>
<
asp:Button
ID
=
"b_PostBack"
runat
=
"server"
Text
=
"Postback"
onclick
=
"b_PostBack_Click"
/>
</
div
>
</
form
>
</
body
>
</
html
>
Thanks
Andy