This is a migrated thread and some comments may be shown as answers.

Problem with Clearing the Selection in ListBox at Client Side

2 Answers 158 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
santhosh
Top achievements
Rank 2
santhosh asked on 30 Jul 2009, 11:01 AM
Hi,
I am using two listboxes with a finish button, I want to clear the selection in the first list box in the SelectedIndexChanged client side event of second listbox and viceversa, below is the code.
 <script language="javascript" type="text/javascript">

 

 

function ExistingonSelectedIndexChanged(sender, args)

 

 

 {

 

var listbox = $find("<%= lstAvailablePlans.ClientID %>");

 

 

 

listbox.trackChanges();

 

 

 listbox.clearSelection();

listbox.commitChanges();

}

function AvailableonSelectedIndexChanged(sender, args)

 {

 

var listbox = $find("<%= lstExistingPlans.ClientID %>");

 

 

 

listbox.trackChanges();

 

listbox.clearSelection();

listbox.commitChanges();

}

 

</script>

 

 

<table cellpadding="2" cellspacing="2" border="0" class="TableBorder" width="100%">

 

 

<tr valign="top">

 

<td style="width: 105px">&nbsp;</td>

 

<td class="clsLabel">

 

<asp:Label id="lblExisting" runat="server" text="<%$ Resources:pageLabels, lblExistingPlans %>" CssClass="clsLabel"></asp:Label>

 

</td>

 

<td style="width: 100px">&nbsp;</td>

 

</tr>

 

<tr valign="top">

 

<td style="width: 105px">&nbsp;</td>

 

<td>

 

<telerik:RadListBox ID="lstExistingPlans" runat="server" Width="763px" Height="250px" CssClass="clsLable" Skin="Office2007" OnClientSelectedIndexChanged="ExistingonSelectedIndexChanged"></telerik:RadListBox>

 

</td>

 

<td style="width: 100px">&nbsp;</td>

 

 

</tr>

 

 

<tr valign="top">

 

 

<td style="width: 105px">&nbsp;</td>

 

 

<td class="clsLabel">

 

 

<asp:Label id="lblAvailable" runat="server" text="<%$ Resources:pageLabels, lblAvailablePlans %>" CssClass="clsLabel"></asp:Label>

 

 

</td>

 

 

<td style="width: 100px">&nbsp;</td>

 

 

</tr>

 

 

<tr valign="top">

 

 

<td style="width: 105px">&nbsp;</td>

 

 

<td>

 

 

<telerik:RadListBox ID="lstAvailablePlans" runat="server" Width="763px" Height="250px" CssClass="clsLable" Skin="Office2007" OnClientSelectedIndexChanged="AvailableonSelectedIndexChanged"></telerik:RadListBox>

 

</td>

 

<td style="width: 100px">&nbsp;</td>

 

 

</tr>

 

 

</table>

I could able to clear the selection in first listbox on SelectedIndexChanged client event of second list box and vice versa, but the problem is 

1. I select one record in the first list box 
2. Then I select one record in the second list box
3. Then the selection in the first list box goes off and selection the second list box shows
4. when i click on finish button and at the sever side when i try to access the second list box selected count is 1 and also the first list box selected count is 1 even though i have cleared it in the client side.

Kindly let me know how to fix this issue or wheather its a bug?

Regards,

Santhosh

 

 

 

 

2 Answers, 1 is accepted

Sort by
0
Accepted
Genady Sergeev
Telerik team
answered on 03 Aug 2009, 01:28 PM
Hello santhosh,

This happened to be a bug in the RadListBox. Hopefully, there is a workaround this issue. Put the following code right after your ScriptManager declaration:

 
<script type="text/javascript"
         
        Telerik.Web.UI.RadListBox.prototype.commitChanges = function() { 
            this._logEntriesJson = this._log.serialize(); 
            this._updateSelectedIndicesJson(); 
            this._updateCheckedIndicesJson(); 
            Telerik.Web.UI.RadListBox.callBaseMethod(this"commitChanges"); 
        } 
    </script> 

I have updated your Telerik points for your bug report.

Greetings,
Genady Sergeev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
santhosh
Top achievements
Rank 2
answered on 04 Aug 2009, 12:37 PM
Hi Genady Sergeev,

Thanks for the workaround solution, its working fine now.

Regards,

Santhosh
Tags
ListBox
Asked by
santhosh
Top achievements
Rank 2
Answers by
Genady Sergeev
Telerik team
santhosh
Top achievements
Rank 2
Share this question
or