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

Problem with Radcombox selected index changed event

10 Answers 274 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Nandita Kotha
Top achievements
Rank 1
Nandita Kotha asked on 14 Mar 2010, 10:35 PM
Hi,

I have 4 rad combo boxes in my page.

Below is my aspx page code...

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="NewSAModalPopup.aspx.vb" StylesheetTheme="Default" Inherits="SelfAssess_NewSAModalPopup" %>

<%@ Register Assembly="Telerik.Web.UI, Version=2009.2.701.35, Culture=neutral, PublicKeyToken=121FAE78165BA3D4"
    Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    
    
</head>
<body>
    <form id="form1" runat="server">
    <div>
     <script type="text/javascript">
    function GetRadWindow() {
        var oWindow = null;
        if (window.radWindow)
            oWindow = window.radWindow;
        else if (window.frameElement.radWindow)
            oWindow = window.frameElement.radWindow;
        return oWindow;
    }
    function CancelClick()
    {
        var oWindow = GetRadWindow();
        oWindow.argument = null;
        oWindow.close();
        top.location.reload();
        //window.close();
    }

    function relaodParentWindow() {
        top.location.reload();
    }
    
    function closeWin() {
        var oWnd = GetRadWindow();
        oWnd.close();
        top.location.reload();
        //window.close();
    }
    </script>
      <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        </telerik:RadScriptManager> 
    <telerik:RadAjaxManager runat="server" ID="RadAjaxManager1" >
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="c_rcbCustomer">
              <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="c_rdbYear" />
                    <telerik:AjaxUpdatedControl ControlID="c_rcbAssessment" />
                    <telerik:AjaxUpdatedControl ControlID="c_rcbfacilityContact" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="c_rdbYear">
                <UpdatedControls>   
                    <telerik:AjaxUpdatedControl ControlID="c_rcbAssessment" />
                    <telerik:AjaxUpdatedControl ControlID="c_rcbfacilityContact" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="c_rcbAssessment">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="c_rcbfacilityContact" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    
   </telerik:RadAjaxManager>
    
     <table style="text-align:left;">
        <tr>
            <td>
                  <table>
                  <tr>
                  <td colspan ="3" align="center">
                
                <asp:Label  ID="c_lblErrorText" runat="server" Visible="False" Font-Bold="True" ForeColor="Red"></asp:Label>
                
                  </td>
                  </tr>
                                        <tr>
                                            <td>
                                               Step 1: 
                                            </td>
                                            <td>
                                            Select the customer
                                            </td>
                                        </tr>
                                        <tr>
                                        <td>
                                        
                                        </td>
                                        <td>
                                            <telerik:RadComboBox ID="c_rcbCustomer" runat="server" AutoPostBack="True" Width="205px"
                                     Filter="Contains" LoadingMessage="<div style='width:100%; height:23px; vertical-align:middle; text-align:center;'>Loading <img src='../Images/loading5.gif' /><div>"
                                     EmptyMessage="--Select One--" EnableTextSelection="true" ExpandDelay="0" >
                                 <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
                                 <ExpandAnimation Type="Linear" Duration="50" />                                
                            </telerik:RadComboBox>
                                            <asp:RequiredFieldValidator ID="c_rfvCustomer" runat="server" ErrorMessage="Select a customer" ControlToValidate="c_rcbCustomer"></asp:RequiredFieldValidator>
                                            <br />
                                            <br />
                                        </td>
                                        </tr>
                                       
                                          <tr>
                                            <td >
                                               Step 2: 
                                            </td>
                                            <td>
                                                Select the year for which you are entering the data</td>
                                        </tr>
                                        <tr>
                                        <td>
                                        
                                        </td>
                                        <td>
                                        
                                             <telerik:RadComboBox ID="c_rdbYear" runat="server" AutoPostBack="True" Width="205px"
                                     Filter="Contains" LoadingMessage="<div style='width:100%; height:23px; vertical-align:middle; text-align:center;'>Loading <img src='../Images/loading5.gif' /><div>"
                                   EnableTextSelection="true" ExpandDelay="0" >
                                 <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
                                 <ExpandAnimation Type="Linear" Duration="50" />                                
                            </telerik:RadComboBox>
                                            <asp:RequiredFieldValidator ID="c_rfvYear" runat="server" 
                                                ErrorMessage="Select a Year" ControlToValidate="c_rdbYear"></asp:RequiredFieldValidator>
                                            <br />
                                            <br />
                                        </td>
                                        </tr>
                                        
                                          <tr>
                                            <td >
                                               Step 3: 
                                            </td>
                                            <td>
                                                Select the assessment to start</td>
                                        </tr>
                                        <tr>
                                        <td>
                                        
                                        </td>
                                        <td>
                                    
                                            <telerik:RadComboBox ID="c_rcbAssessment" runat="server" AutoPostBack="True" Width="580px"
                                     Filter="Contains" LoadingMessage="<div style='width:100%;vertical-align:middle; text-align:center;'>Loading <img src='../Images/loading5.gif' /><div>"
                                   EmptyMessage="-- Please complete step 1 and 2 --" EnableTextSelection="true" 
                                                ExpandDelay="0" >
                                 <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
                                 <ExpandAnimation Type="Linear" Duration="50" />                                
                            </telerik:RadComboBox>
                                            &nbsp;
                                            <asp:RequiredFieldValidator ID="c_rfvAssessment" runat="server" 
                                                ErrorMessage="Select the assessment" ControlToValidate="c_rcbAssessment"></asp:RequiredFieldValidator>
                                            <br />
                                            <br />
                                        </td>
                                        </tr>
                                        
                                          <tr>
                                            <td >
                                               Step 4: 
                                            </td>
                                            <td >
                                                Select the primary contact</td>
                                        </tr>
                                        <tr>
                                        <td>
                                        
                                        </td>
                                        <td>
    
                                             <telerik:RadComboBox ID="c_rcbfacilityContact" runat="server" 
                                                AutoPostBack="True" Width="577px"
                                     Filter="Contains" LoadingMessage="<div style='width:100%; height:23px; vertical-align:middle; text-align:center;'>Loading <img src='../Images/loading5.gif' /><div>"
                                   EmptyMessage="-- Please complete step 1 through 3 --" EnableTextSelection="true" 
                                                ExpandDelay="0" >
                                 <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
                                 <ExpandAnimation Type="Linear" Duration="50" />                                
                            </telerik:RadComboBox>
                                            
                                            <br />
                                        </td>
                                        </tr>
                                          </table>
            </td>
        </tr>       
         <tr>
            <td >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <asp:Button ID="c_btnStart" runat="server" Text="Start" />&nbsp;&nbsp;&nbsp;&nbsp;
                <asp:Button ID="c_btnCancel" runat="server" Text="Cancel" 
                    onclientclick="CancelClick();" />
            </td>
        </tr>
    </table>
    </div>
    </form>
</body>
</html>



My aspx.vb have the following events:
 Protected Sub c_rcbAssessment_SelectedIndexChanged(ByVal o As Object, ByVal e As Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs) Handles c_rcbAssessment.SelectedIndexChanged
        LoadFacilityContact(c_rcbAssessment.SelectedValue)
    End Sub

    Protected Sub c_rdbYear_SelectedIndexChanged(ByVal o As Object, ByVal e As Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs) Handles c_rdbYear.SelectedIndexChanged
        LoadSelfAssessments(c_rcbCustomer.SelectedValue, c_rdbYear.SelectedValue)
    End Sub
   
    Protected Sub c_rcbCustomer_SelectedIndexChanged(ByVal o As Object, ByVal e As Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs) Handles c_rcbCustomer.SelectedIndexChanged
        LoadYear()
    End Sub

 when I change the selection in the year comboxbox, c_rdbYear_SelectedIndexChanged is being fired which is fine.Now, when I change the selection in  c_rcbAssessment combobox,  c_rcbCustomer_SelectedIndexChanged is being fired first and then c_rcbAssessment_SelectedIndexChanged is fired.I dont know why  c_rcbCustomer_SelectedIndexChanged is being fired.It want only  c_rcbAssessment combobox to be fired.
And also when I change the year combobox selection again,it is firing c_rcbCustomer_SelectedIndexChanged first and then  c_rdbYear_SelectedIndexChanged.

Any kind of help would be appreciated.

Thanks.

10 Answers, 1 is accepted

Sort by
0
Marcus
Top achievements
Rank 1
answered on 15 Mar 2010, 02:36 PM
I am having the exact same issue.

It seems that when you bind the first Combo on Page Load this gives the problems as above. But if you create the items in the first Combo at design time then the stated issue disappears.

Obviously I would like to dynamically load the first Combo and would also appreciate any help...

Marcus
0
Nandita Kotha
Top achievements
Rank 1
answered on 15 Mar 2010, 02:45 PM
I am having loadcustomers() ( my first dropdown) in the page load event.

I am loading the data from database.

Let me know of any solution for this.
0
Marcus
Top achievements
Rank 1
answered on 15 Mar 2010, 02:53 PM
Exactly:-

Try This:

1: Remove the loadcustomers()
2: Fill the Combo collection manually with say 2 customers - The Text and the Value
3: Load your page again and the issue should be resolved.

So like I say the problem seems to be with the initial .Bind() of the control on Page Load.

Can the Telerik Guys help us as this is driving me MAD!!!!

Marcus


0
Nandita Kotha
Top achievements
Rank 1
answered on 15 Mar 2010, 02:56 PM
HI Marcus,

Thanks for the reply.I would like to load customer rad combobox dynamically (data from database).I dont want to add items manually.

Let me know if you know any solution for that.

Thanks.
0
Veronica
Telerik team
answered on 16 Mar 2010, 02:54 PM
Hi Nandita Kotha,

Could you please show me the code of the methods for binding the RadCombos:

LoadFacilityContact, LoadSelfAssessments and LoadYear.

At this moment I've tested your code with adding elements of the RadCombos in .aspx just to see how the SelectedIndexChanged is behaving. It works OK. Maybe there is something in your methods which causes the firing of SelectedIndexChanged events.

Thank you.

All the best,
Veronica Milcheva
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Sam
Top achievements
Rank 1
answered on 16 Jun 2011, 07:12 AM
Hello,

i am having same problem, my code is as below, i have tried to create function for feeling comboboxes but it doesn't work either

this is my ajax settings
<telerik:AjaxSetting AjaxControlID="ddlCountry">
               <UpdatedControls>
                   <telerik:AjaxUpdatedControl ControlID="Sdp" LoadingPanelID="PanelLoading" />
               </UpdatedControls>
           </telerik:AjaxSetting>
           <telerik:AjaxSetting AjaxControlID="ddlState">
               <UpdatedControls>
                   <telerik:AjaxUpdatedControl ControlID="Sdp" LoadingPanelID="PanelLoading" />
               </UpdatedControls>
           </telerik:AjaxSetting>
           <telerik:AjaxSetting AjaxControlID="ddlCIty">
               <UpdatedControls>
                   <telerik:AjaxUpdatedControl ControlID="Sdp" LoadingPanelID="PanelLoading" />
               </UpdatedControls>
           </telerik:AjaxSetting>


this are my events

protected void ddlCountry_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
    {
        ddlState.Items.Clear();
        if (ddlCountry.SelectedItem != null) ddlState.FillControlSP();
        ddlState_SelectedIndexChanged(ddlState, new RadComboBoxSelectedIndexChangedEventArgs("", "", "", ""));
    }
 
    protected void ddlState_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
    {
        ddlCIty.Items.Clear();
        if (ddlState.SelectedItem != null) ddlCIty.FillControlSP();
        ddlCIty_SelectedIndexChanged(ddlCIty, new RadComboBoxSelectedIndexChangedEventArgs("", "", "", ""));
    }
 
    protected void ddlCIty_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
    {
        ddlSubDistrict.Items.Clear();
        if (ddlCIty.SelectedItem != null) ddlSubDistrict.FillControlSP();
    }
0
Veronica
Telerik team
answered on 16 Jun 2011, 02:33 PM
Hi Sam,

Could you please open new support thread and send me your code attached in a .zip file. That way I can inspect it and help you. 

Thank you! 

Best wishes,
Veronica Milcheva
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Tom Klawsuc
Top achievements
Rank 1
answered on 28 Jul 2011, 06:15 PM
I was having the same issue but only on the web server...worked fine on my local development environment so I assume it has to do something with the OS or web environment on the server. The way I overcame this issue is to check if the combobox value in each selectedindexchanged event changed and only perform the related logic if the event was triggered by the associated combobox.

protected void ClinicID_SelectedIndexChanged(object o, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
    {
        if (!e.Value.Equals(e.OldValue))
        {
            //perform some logic that should happen only ClinicID combobox changed
        }
    }
0
Peter
Telerik team
answered on 29 Jul 2011, 09:01 AM
Hello Tom,

Thank you for sharing your findings in the forum.

Greetings,
Peter
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Shilpa
Top achievements
Rank 1
answered on 05 Aug 2011, 07:12 AM
HI,

I am also facing the same issue with the IE browser. But the code is working fine in Firefox. Can you give me the solution to over this event getting fired in IE.

Thanks & Regards,
Shilpa
Tags
ComboBox
Asked by
Nandita Kotha
Top achievements
Rank 1
Answers by
Marcus
Top achievements
Rank 1
Nandita Kotha
Top achievements
Rank 1
Veronica
Telerik team
Sam
Top achievements
Rank 1
Tom Klawsuc
Top achievements
Rank 1
Peter
Telerik team
Shilpa
Top achievements
Rank 1
Share this question
or