Hi,
I have 3 WebDropDowns on my page in an update panel all with EnableCustomValues=false. After the user selects an item from the first dropdown a postback occurs and the next dropdown is populated with relevant data. This works fine if the user selects an item using the dropdown button, the problem I am having though is that if the user starts to type in the dropdown a postback occurs before something has been selected. I have tried different settings using the AutoPostBackFlags but don't seem to be able to stop this postback happening before a complete value has been selected. Can you please advise on how I might achieve this?
Many Thanks
Hello wakefl,
Thank you for posting in the community.
What may be hapenning here is that when typing in the dropdown's input field, the selectionChanging/ValueChanging clientside events are being fired initiating a postback to load the items into your cascading doprodowns. I suggest that you set the DisplayMode of your WebDropDowns to DropDownList in order to disallow typing in the input field (keyboard item navigation will still be possible).
Please let me know if this helps.
Hi Peter,
Thanks for your quick response. I have tried the DropDownList and would be happy to use it but when I use the DropDownList it wipes out the CurrentValue which I set to 'Please select' and shows the first item returned from the datatable. Is there a way to use CurrentValue when using the DropDownList DisplayMode?
Thanks
Thank you for your reply.
The CurrentValue property is currently supported only when using the DropDown display mode.
I have researched this further however, and it seems that a "partial" custom value is passed only to the valueChanging event (selectionChanging returns an existing item as the newly selected one). If you are loading items at the ValueChanging stage I would suggest either moving that logic to the SelectionChanged stage, or otherwise checking whether the new value exists in the dropdown's value list.
Thanks Peter.
I moved the loading items logic to the SelectionChanged stage and set the AutPostBackFlags SelectionChanged to On and it works as needed.
Thanks for your reply.
Glad that the matter has been resolved.
Please feel free to contact me if you have any further questions regarding this scenario.
Hi Petar,
I have the same issue , where I have two different webdropdown where I want Second webdropdown should be filled on selectionchanged event of the first webdropdown. I am calling a method onSelectionchanged event of first webdropdown and the AutoPostback is set to true and the Display Mode is DropDown.
But as soon as I start writing in the first webdropdown on the first character itself it fires postback and I am unable select the Item that I want. I know that the problem can be solve if I Choose DisplyMode DropDownList, But I want to write and select the Item, as it is the faster way to select the item.
Please Help me in this. Below is my Code of first WebDropdown.
AutoPostBack="true" AutoFilterSortOrder="Ascending" DisplayMode="DropDown" EnableViewState="true" OnSelectionChanged="ddBillingCustomer_SelectionChanged">
I have tried all the above solutions that you have provided before like (AutoPostBackFlags-SelectionChanged="on"), but it is not working.
Nizam Ansari.