Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1410
SelectionChanged event not working properly
posted

Hi,

I am using 2 webdropdowns on a page in my web application.

1) Group webdropdown

2) Subitems webdropdown

The values in the Subitems dropdown varies depending upon what is selected from the Group dropdown. To accomplish this, I am using a

SelectionChanged client-side event with the Group webdropdown as follows:

aspx page code:

<ig:WebDropDown id="Groupdropdown" runat="server" cssclass="igdd_Control" Height="12px" Width="400px" EnableAnimations="False" EnableCustomValues="False">

<ClientEvents SelectionChanged ="loadsubItems"/></ig:WebDropDown>

<ig:WebDropDown id="SubItemsdropdown" runat="server" cssclass="igdd_Control" Height="12px" Width="415px" EnableAnimations="False" EnableCustomValues="False" OnItemsRequested="cmbSubItems_OnItemsRequested">

javascript code:

function loadsubItems(sender, e) {

var subItemsCmb; 

 subItemsCmb= $find("SubItemsdropdown");

subItemsCmb.set_currentValue("", true);

subItemsCmb.loadItems(e.getNewSelection()[0].get_value(),false);

}

Code-behind vb code:

Protected Sub cmbSubItems_OnItemsRequested(ByVal sender As Object, ByVal e As Infragistics.Web.UI.ListControls.DropDownItemsRequestedEventArgs)

 // Code to check e.value and then populate the subitems dropdown based upon e.value

End Sub

The problem that I am facing is:

As soon as I type a character in the group dropdown, the control is automatically going to the subitems dropdown. Suppose, there are 2 values in the group dropodown as follows:

0100 POLITICS

0200 SCIENCE

As soon as I type "0", "0100 POLITICS' is getting selected and control is automatically going to the subitems dropdown. If I type "02" quickly, only 02 remains in the dropdown and control is automatically going to the second dropdown.

I don't want the control to automatically go to the subitems dropdown. When I type 0 in the group dropdown, I should have the capability to select any value starting with "0". Moreover, only the items present in the dropdown should appear in the textfield.

Please let me know how to accomplish this.

Thanks,

Sunil Mehta.

Parents Reply Children