Combo box select method at client side

2 posts, 0 answers
  1. Shrirang
    Shrirang avatar
    10 posts
    Member since:
    May 2009

    Posted 30 Mar 2010 Link to this post

    HI,
        i have one combox and some checkbox

    <telerik:RadComboBox ID="ddlAction" Width="120px" EnableEmbeddedSkins="false"
                                                                Skin="IELSkin" Height="55px" runat="server" OnClientSelectedIndexChanged="fnSetAction">
                                                                <Items>
                                                                    <telerik:RadComboBoxItem Text="--Select Action--" Selected="true" Value="0" />
                                                                    <telerik:RadComboBoxItem Text="Copy" Value="2" />
                                                                    <telerik:RadComboBoxItem Text="Delete" Value="1" />
                                                                </Items>
                                                            </telerik:RadComboBox>

    <asp:CheckBox ID="chk1" runat="server" />
    <asp:CheckBox ID="chk2" runat="server" />
    <asp:CheckBox ID="chk3" runat="server" />
    <asp:CheckBox ID="chk4" runat="server" />




       
    if i select any of these copy or delete form combox i have to check wheather is there any checkbox check.
    if not i have to raise the alert and make the combox selection to the "--Select Action--"..

    i am using  select() method
    but if i use this method it again fires the OnClientSelectedIndexChanged event.it starts looping
    somehow i have to stop this firing event
    i tried get_selected()  method but it doesn't work.


    function fnSetAction(sender,args)
    {
         //Check if any check box is checked
    var ddlAction11 = sender
    ddlAction11.get_items().getItem(0).select();
    }

    please suggest me some solution as soon as possible.
    Waiting for your fruitfull reply

    cheers
    Shrirang Dhere




  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 30 Mar 2010 Link to this post

    Hi Shrirang Dhere,

    You could attach 'OnClientSelectedIndexChanging' to RadComboBox, so that you can cancel the selectionchange event if any of the checkboxes are not checked.

    JavaScript:

     
        function OnClientSelectedIndexChanging(sender, args) {  
            // Check if any checkbox is checked  
            args.set_cancel(true);  // Cancel the event if any of cehckboxes not checked  
        } 

    -Shinu.

Back to Top