views:

170

answers:

1

Telerik radlistbox fires both OnClientItemChecked and OnClientSelectedIndexChanged when an item is checked in Firefox and IE but not in Chrome.

Chrome seems to have the proper behavior. Is there a reason for this? Can I make IE and Firefox behave accordingly as well?

Some more context;

This radlistbox gets loaded in an ascx panel.

<telerik:RadListBox CheckBoxes="true" EnableDragAndDrop="True" Height="400" 
ID="radListBox0" OnClientItemChecked="OnClientItemChecked" 
OnClientSelectedIndexChanged="OnClientSelectedIndexChanged" runat="server" 
SelectionMode="Single" Visible="true" Width="275" />

And here is the Javascript it calls declared within the same ascx file:

<telerik:RadCodeBlock ID="radCodeBlock" runat="server">

    <script type="text/javascript">
        function OnClientSelectedIndexChanged(sender, eventArgs) {
                        var ajaxManager = 
                            $find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>");
                        var t = sender._clientStateFieldID;
                        if (ajaxManager != null)
                            ajaxManager.ajaxRequest("ListBoxIndexChanged|" + t);
        }
        function OnClientItemChecked(sender, eventArgs) {

        }
    </script>
</telerik:RadCodeBlock>

9/22/2010 17:03 EDIT: So I'm on the latest version as in the first response. Still no luck. I did what I should have done first and tried just a vanilla radlistbox on a blank aspx page. There was no error there so I'm guessing that it has to do because the control problems is built inside an modal popup on a page with multiple layers of custom controls and even master pages. At least I know it's not Telerik now.

A: 

I tried to reproduce the problem but was unable to do so (Windows 7 x64). I've tested the following code under Chrome 6.0, FireFox 3.6.10 and IE 8 and all behaved the same:

<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

<html xmlns="http://www.w3.org/1999/xhtml"&gt;
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="scm" runat="server" />


        <telerik:RadCodeBlock ID="radCodeBlock" runat="server">

        <script type="text/javascript">
            function OnClientSelectedIndexChanged(sender, eventArgs) {
                alert('OnClientSelectedIndexChanged');
            }
            function OnClientItemChecked(sender, eventArgs) {
                alert('OnClientItemChecked');
            }
            </script>
        </telerik:RadCodeBlock>

        <telerik:RadListBox 
            CheckBoxes="true" 
            EnableDragAndDrop="True" 
            ID="radListBox0" 
            OnClientItemChecked="OnClientItemChecked" 
            OnClientSelectedIndexChanged="OnClientSelectedIndexChanged" 
            runat="server" 
            SelectionMode="Single" 
            Visible="true">
            <Items>
                <telerik:RadListBoxItem Value="value1" Text="text1" />
                <telerik:RadListBoxItem Value="value2" Text="text2" />
                <telerik:RadListBoxItem Value="value3" Text="text3" />
            </Items>
        </telerik:RadListBox>
    </form>
</body>
</html>

Only a single client handler was invoked: either OnClientItemChecked or OnClientSelectedIndexChanged

Darin Dimitrov
Thanks, that's good info. What version of Telerik ASP.NET controls are you using? Even when I just copy and paste your code in, both events trigger on check.
Matt
Using `Telerik.Web.UI, Version=2010.2.826.40, Culture=neutral, PublicKeyToken=121fae78165ba3d4` in ASP.NET 4.0 project. I've just downloaded a fresh copy directly from the telerik site and strangely the zip is called `Telerik.Web.UI_2010_2_826_Dev_hotfix.zip` :-)
Darin Dimitrov