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

Combo box select method at client side

1 Answer 252 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Shrirang
Top achievements
Rank 1
Shrirang asked on 30 Mar 2010, 12:07 PM
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




1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 30 Mar 2010, 12:41 PM

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.

Tags
ComboBox
Asked by
Shrirang
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or