I have a WebDropDown "DDthisWeek" representing the week number of a year in my page and filled not from a datasource but only by Items 1 to 52.While loading the page in the preload event I set one item to be the selected item e.g. that item that the actual week represents. That works so far.But now if the user selects an other item in that DropDown the DDthisWeek_SelectionChanged is fired. Now in the code of this event handler I want to find out, which new value is selected and so I tried this:
Dim var = DDthisWeek.selectedValue
val idx = me.DDthisWeek.ActiveItemIndex
2. now using this to set the selection:
Me.DDthisWeek.Items(idx).Selected = True
3.no this has the expected value:
var = DDthisWeek.selectedValue
But this works only the first time! If I now select another Item, I get the correct ActiveItemIndex but line 3 gives me still the old value.How can I get the correct value after the user has selected an item.
my DropDowns code ist
<ig:WebDropDown ID="DDthisWeek" runat="server" Width="50px" AutoPostBack="False" AutoPostBackFlags-SelectionChanged="On"> <AutoPostBackFlags SelectionChanged="On" /> <Items> <ig:DropDownItem Key="01" Selected="False" Text="01" Value="01"> </ig:DropDownItem> <ig:DropDownItem Key="02" Selected="False" Text="02" Value="02"> </ig:DropDownItem> <ig:DropDownItem Key="03" Selected="False" Text="03" Value="03"> </ig:DropDownItem> ..... <ig:DropDownItem Key="50" Selected="False" Text="50" Value="50"> </ig:DropDownItem> <ig:DropDownItem Key="51" Selected="False" Text="51" Value="51"> </ig:DropDownItem> <ig:DropDownItem Key="52" Selected="False" Text="52" Value="52"> </ig:DropDownItem> </Items> </ig:WebDropDown>
I am seeing the same thing. SelectedValue returns the old value.
I don't know what to say about this answer. May be that you are recieving the correct values, but I can not understand this. How can it be that I can reproduce this error every time I want it to do and you can't see any error?
As I wrote in the last post, I have set a brakepoint in the DDthisWeek_SelectionChanged event and there I definitely get the wrong (the last selected) value at that point. I'm using Visual Studion 2010 and the Infragistics .NetAdvantage Version is 10.3.20103.2105.And I still have this behavior and I thought that my example show it clearly. I have just verified that I have send the correct sample.
Hi,
I have stepped through your sample and it actually looks to be working correctly. By that I mean, I'm getting the correct values for ActiveItemIndex, CurrentValue, SelectedValue, SelectedItemIndex, etc, after each pass through test. So, it looks to be worked as expected.
Is there a chance that you are taking note of the SelectedValue before completely stepping through the code? If you haven't stepped through to the point of passing in the index of the new selection into the control, you won't be able to see the SelectedValue reflect the current selection.
I hope this helps. Please let me know if you have any additonal questions.
Sincerely,TroyDeveloper Support Engineer
Ok. I created a sample showing this effect. Here I have one dropdown and this dropdown is set in the page_preload event to a value which is representing the actual week number of a year. Now try to select an other week number. The DDthisWeek_SelectionChanged event is fired and there the new selected value is expected. As you can see there in the first line (there is a breakpoint) the old value was recieved.
Hello,
I have recreated a sample project following the pattern you describe here, but the behavior i'm experiencing is as expected. That is, upon changing the selection in the WebDropDown, the SelectedValue is adjusted to the current value of the WebDrowDown list. I've tested by changing the WebDrowDown value several times to verify correct behavior. If you send me your sample I will take a look to see what's happening.