Selectionmode = "Single" Not Working

2 posts, 0 answers
  1. James
    James avatar
    11 posts
    Member since:
    Jan 2011

    Posted 26 Sep 2011 Link to this post

    Hello,

    I have a RadListBox that is will only allow multiple selection. I have Selectionmode="Single" set but that does not work. I have also tried some Javascript with no luck. Obviously this is a bug but what can I do hear to get the selection mode to single.

    <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="DataMigration.ascx.cs"
        Inherits="PDS.DataMigration1" %>
    <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
    <style type="text/css">
        .style8
        {
            color: #FFFFFF;
        }
    </style>
    <telerik:RadScriptBlock ID="ScriptBlock" runat="server">
    <script type="text/javascript">
      
        function reMigrate()
        {
            var button = $find("<%= rb_Migrate.ClientID %>");
            button.click();
        }
    </script>
    </telerik:RadScriptBlock>
    <div style="text-align: center; width: 100%">
        <div style="text-align: left">
            <div style="text-align: center; width: 700px; margin-top: 40px">
                <asp:Panel ID="Panel2" runat="server" Width="650px" Height="450px" BackColor="#62768A">
                    <span class="style8">
                        <label>
                            Select Dealership</label></span>
                    <br />
                    <telerik:RadComboBox runat="server" ID="rcb_Dealerships" Width="280px" AutoPostBack="true"
                        EnableEmbeddedSkins="false" OnDataBinding="rcb_Dealerships_DataBinding" OnSelectedIndexChanged="rcb_Dealerships_SelectedIndexChanged">
                    </telerik:RadComboBox>
                    <br />
                    <br />
                    <span class="style8">
                        <label style="text-align: left">
                            Select Accounts</label></span>
                    <br />
                    <telerik:RadListBox ID="rlb_Accounts" runat="server" Width="600px" Height="300px" CheckBoxes="true" EnableEmbeddedSkins="false"
                    BackColor="#E1EAF2" BorderColor="#E1EAF2" style="text-align: left" AutoPostBack="true" SelectionMode="Single" >
                    </telerik:RadListBox>
                    <br />
                    <br />
                    <telerik:RadButton ID="rb_Migrate" runat="server" Width="150px" Text="Migrate Accounts"
                        Skin="WebBlue" BackColor="#33393E" ForeColor="Black" OnClick="rb_Migrate_Click">
                    </telerik:RadButton>
                    <telerik:RadWindowManager ID="RadWindowManager1" runat="server" 
                        EnableEmbeddedSkins="false" EnableViewState="false" >
                        <%--<Windows>
                        <telerik:RadWindow runat="server" ID="ProductWin">
                        </telerik:RadWindow>
                        </Windows>--%>
                    </telerik:RadWindowManager>
                    <br />
                    <cc1:RoundedCornersExtender ID="RoundedCornersExtender2" runat="server" TargetControlID="Panel2"
                        Radius="9">
                    </cc1:RoundedCornersExtender>
                </asp:Panel>
            </div>
        </div>
    </div>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="WebBlue">
    </telerik:RadAjaxLoadingPanel>
    <telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="Panel2">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="Panel2" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="GridPanel">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="GridPanel" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManagerProxy>
  2. James
    James avatar
    11 posts
    Member since:
    Jan 2011

    Posted 26 Sep 2011 Link to this post

    Fixed. If your selectionmode is not working when set to selectionmode = "Single", call this javascript function on the "OnClientItemChecking" event:

    function singleSelection(sender, args)
        {
            var item = args.get_item();
            var items = sender.get_items();
            var checked = item.get_checked();
            if (checked == false)
            {
                items.forEach(function (itm) { itm.set_checked(false); });
            }
        }
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top