I'm modeling my code on this example: http://samples.infragistics.com/2010.3/WebFeatureBrowser/WebDropDown/WebDropDownCascadeClient.aspx
I have three WebDropDown controls: wdd1, wdd2, wdd3.
When wdd1 's selection changes, I want new values to be cascaded to wdd2 & wdd3. I've tried to code it both server -side and client-side, and neither work. My code for server-side/client-side are the same except for the lines marked "comment-toggle".
function wdd1_SelectionChanged(sender, args) { // get the selected value of the current WDD (wddPayroleSite) value = args.getNewSelection()[0].get_value(); cascadeWebDropdown(value); return; } function cascadeWebDropdown(value) { var wdd2 = $find('<%= wdd2.ClientID %>'); var wdd3 = $find('<%= wdd3.ClientID %>'); wdd2.loadItems(value); wdd3.loadItems(value); // comment-toggle }
Protected Sub wdd2_ItemsRequested(ByVal sender As Object, ByVal e As Infragistics.Web.UI.ListControls.DropDownItemsRequestedEventArgs) Handles wdd2.ItemsRequested Dim text As String = CType(e.Value, String) Dim id As Integer = 0 If (Integer.TryParse(text, id)) Then LoadWdd2(id) ' LoadWdd3(id) ' comment-toggle End If End Sub
LoadWdd2() & LoadWdd3() are functions that perform the databind to their respective WDD controls.
Also, how can I prevent the auto-opening of the child WDD? Going back to the sample, if I select a country, the state WDD opens and focuses automatically. I don't want this to occur.
Hello ,
The issue with auto-opening child is fixed in the latest service release.
Regarding the cascading issue I tried to reproduce the behavior with the online sampe but with no avail.
Can you please let me know what does LoadWdd2 method do? ( LoadWdd2(id) )
Where is the value variable declared ? I recommend you renaming it because by default the local variables override the global ones (I mean cascadeWebDropdown(value) function)
value = args.getNewSelection()[0].get_value();
I am attaching the example I extrated from the online sample.
Please refer to the zipped attachment.
thanks for the reply.
I do not have a global variable called value, I must I must have omitted "var" in wdd1_SelectionChange
LoadWdd2(id) just performs a DB query (using id in the where clause) and databinds the WDD.
This is all moot since I've decided to go with the UpdatePanel method. It will be easier for maintenance programmers that may not know JavaScript as well.