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

selectedindexchanged firing all RadComboBox Handlers

5 Answers 191 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Rahul
Top achievements
Rank 1
Rahul asked on 08 Nov 2012, 01:55 PM
Hi Guys,

I have 2 RadComboBox in my asp page when I select values in any of these object it trigger selectedindexchanged handler for both combobox.

  These are my codes

<telerik:RadScriptManager runat="server" ID="RadScriptManager" />
<table>
<tr>
<td>Customer Set:</td>
<td>
    <telerik:RadComboBox ID="Radbox1" runat="server" CheckBoxes="true" EnableCheckAllItemsCheckBox="true"
    Width="300" Height="200" AutoPostBack="True" OnSelectedIndexChanged="Radbox1_SelectedIndexChanged" /> 
 </td>
</tr>
<tr>
 <td>Event Set:</td>
<td>
     <telerik:RadComboBox ID="Radbox2" runat="server" CheckBoxes="true" EnableCheckAllItemsCheckBox="true"
     Width="300" Height="200" AutoPostBack="True" OnSelectedIndexChanged="Radbox2_SelectedIndexChanged" /> 
</td>
</tr>

 Protected Sub Radbox1_SelectedIndexChanged(sender As Object, e As Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs) Handles Radbox1.SelectedIndexChanged
 
 End Sub
 
 Protected Sub Radbox2_SelectedIndexChanged(sender As Object, e As Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs) Handles Radbox2.SelectedIndexChanged
 
 End Sub

When I click on Radbox1 it  trigger both Radbox1 and Radbox2 handler.

Edit : I tried to put a asp dropdown along with these combo boxes and when I select these combo boxes handler of asp drop down is not triggering which made me think if it is anything to do with telerik handler.

Edit2: When I tried to set CheckBoxes="false" for Radbox2 then Radbox1 event handler  is only executed . 



Any Help much appreciated ,

Thanks,
Rahul

5 Answers, 1 is accepted

Sort by
0
Kalina
Telerik team
answered on 12 Nov 2012, 03:48 PM
Hi Rahul,

As far as I understand – you want to use the CheckBoxes feature of the RadComboBox.
In this case you have to handle the ItemChecked event instead of SelectedIndexChanged.
Please find more details about ItemChecked at this help article.


Regards,
Kalina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Rahul
Top achievements
Rank 1
answered on 13 Nov 2012, 10:30 AM
Hi Kalina,

Thanks for the reply , ItemChecked will be fine for me if I need to trigger my event handler each time I select an item but in my case I need to trigger event handler once I complete selecting multiple item. Is there anyway we can do that  in ComboBox? .


Thanks,
Rahul 
0
Shinu
Top achievements
Rank 2
answered on 14 Nov 2012, 05:19 AM
Hi Rahul,

One suggestion is that you can set a flag in OnClientItemChecked event and trigger postback in OnClientItemChecked event of RadComboBox as follows.

JS:
<script type="text/javascript" language="javascript">   
    var flag = false;
    function OnClientBlur(sender, args)
    {
        if (flag)
        {
            __doPostBack("<%= RadComboBox6.ClientID %>", "");
            __doPostBack("<%= RadComboBox7.ClientID %>", "");
        }
    }
    function OnClientItemChecked(sender, args)
    {
        flag = true;
    }
</script>

Thanks,
Shinu.
0
Rahul
Top achievements
Rank 1
answered on 17 Nov 2012, 08:08 PM
Hi Shinu,

Thank for the reply , actually  found another work around which satisfied my requirement . I checked whether Radcombobox.CheckedItems.Count > 0 then only my required action will be executed and also this will make sure the handler is triggered by right object.

Thanks again,
Rahul
0
Balakrishna
Top achievements
Rank 1
answered on 31 Jan 2017, 04:22 PM
Hi Rahul could you please share me the solution 
Tags
ComboBox
Asked by
Rahul
Top achievements
Rank 1
Answers by
Kalina
Telerik team
Rahul
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Balakrishna
Top achievements
Rank 1
Share this question
or