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
608
WebdropDown serves wrong values
posted

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

Unfortunately this does not give me the not the newly selected value but the old. Why? Is that correct and I'm not understanding this correctly?
To get the selected value I have to do the following:
1. Get the active Item index :
 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>

 

 

Parents
  • 10240
    posted

    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.

    Sincerely,
    Troy
    Developer Support Engineer

     

Reply Children