After initializing my dropdown and setting the selectedItemIndex to -1, I would have thought when selecting the first item in the dropdown (with index of 0), it would trigger the selectionChanged event. This doesn't appear to be happening. I have confirmed the dropdown activeitemindex and selecteditemindex are set to -1, but the event doesn't get fired until you have selected any other item except the first item in the list.
Idea's/thoughts/solutions?
Paul
Hello,
Thank you for posting in our community.
Please make sure you have enabled both AutoPostBackFlags for SelectionChanged as well as specifying the event handler. For example:
OnSelectionChanged="WebDropDown1_SelectionChanged"><AutoPostBackFlags SelectionChanged="On" />
I am attaching a runnable code sample to my reply, in order for you to see a working implementation and to be able to play a bit with it. Please let me know in case you have any questions or concerns regarding this matter.
yep, I have that all in place. The problem is with selecting the first item and it is defined through code-behind.
<ig:WebDropDown ID="webdropDown1" runat="server" Width="350px" DisplayMode="DropDownList" EnableCustomValues="False" EnableCustomValueSelection="False" AutoPostBack="True" OnSelectionChanged="webDropDown1_SelectionChanged" StyleSetName="LucidDream"> <AutoPostBackFlags SelectionChanged="On" /></ig:WebDropDown>
Did you had a chance to run the code sample in my previous response?
I am setting WebDropDown1.SelectedItemIndex = -1 explicitly as well. If you drop a breakpoint in WebDropDown1_SelectionChanged handler, you will notice the SelectionChanged event is fired and the breakpoint hit upon changing the selection via the WebDropDown. It includes interaction with the first item “Item 0” as well. You could see the TextBox is populated with the items text and index.
What are the results when you try running the sample? If it is different, are you by any chance using a different than v 15.2.20152.2080 ?
I am looking forward more feedback from you.
Found my answer....setting the DisplayMode="DropDownList" prevented the first item from being selected. Was going to post it yesterday, but the forum website was down.
Thank you for sharing the outcome with the community!