1
Reply

Multi selection dropdownlist

Charan raj

Charan raj

Oct 19 2011 9:06 AM
2.5k
Hi,
Friends i have created multi selected dropdown list ..its fineworking properly..
i have used like a user control...
if its used one usercontrol its working properly but when use multiple user control then its not working..
the code like this...
in usecontrol.ascx
<script type="text/javascript" language="javascript">
    function onCheckBoxClick(chk) {
        debugger;
        var combo = $find("<%= MultiSelectionCombobox.ClientID %>");
        //prevent second combo from closing      
        cancelDropDownClosing = true;
        //holds the text of all checked items      
        var text = "";
        //holds the values of all checked items      
        var values = "";
        //get the collection of all items      
        var items = combo.get_items();
        //enumerate all items
        debugger;
        for (var i = 0; i < items.get_count(); i++) {
            var item = items.getItem(i);
            //get the checkbox element of the current item
            var cb = $get(combo.get_id() + "_i" + i + "_chkBox");
            if (cb.checked) {
                text += item.get_text() + ",";
                values += item.get_value() + ",";
            }
        }
        var res = text.slice(0, text.length - 1);
        alert(res);
        combo.set_text(res);


    }
    function StopPropagation(e) {
        //cancel bubbling
        e.cancelBubble = true;
        if (e.stopPropagation) {
            e.stopPropagation();
        }
    }


    function onDropDownClosing() {
        cancelDropDownClosing = false;
    }    
</script>
<telerik:RadComboBox ID="MultiSelectionCombobox" Runat="server" AutoPostBack="true" OnClientDropDownClosed="onDropDownClosing" EmptyMessage="Select" HighlightTemplatedItems="true" AllowCustomText="true">
                    <Items>
                     <telerik:RadComboBoxItem Text="chireu" Value="chiru" />
                     <telerik:RadComboBoxItem Text="chire3u" Value="chiru2" />
                     <telerik:RadComboBoxItem Text="chireu4" Value="chiru1" />
                    </Items>
            <ItemTemplate>
                <div onclick="StopPropagation(event)">
                    <asp:CheckBox runat="server"  onclick="onCheckBoxClick(this)"  ID="chkBox"/><%# DataBinder.Eval(Container, "Text") %>                  
                </div>
            </ItemTemplate>
        </telerik:RadComboBox>

in .aspx


<UC:multselect id="multiselect1" runat="server">
<UC:multselect id="multiselect2" runat="server">
it is not working can any one knows this sol,,




























































Answers (1)