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
340
SelectedValue does not select
posted

Hi all,

 

I have a simple WebDropDown bound to an object datasource, defined as so

 

<ig:WebDropDown AutoSelectOnMatch="True" 

                                    ID="wddLocation" runat="server" DataSourceID="odsLocation" 

                                    TextField="LocationName" ValueField="LocationID" Width="200px" 

                                    SelectedValue='<%# Bind("LocationID") %>' DisplayMode="DropDownList" 

                                    EnableAnimations="False" >

                                    <DropDownItemBinding TextField="LocationName" ValueField="LocationID" />

                                </ig:WebDropDown>

 

The datasource populates fine, I can see values. However the SelectedValue is just ignored every time? During a postback, I can query the .SelectedValue and see that it did succesfully receive the value, but the client only ever shows the first item in the list.

I tried setting CurrentValue just to ensure it was setting, and that worked fine, currentvalue because the ID I wanted, but obviously I don't want that shown on the dropdown, I want it to select the value automatically.

I have tried AutoSelectMatch being true/false, makes no difference, and not using any autopostbacks.

 

Can anyone shed some light on what's wrong?

Many thanks

 

 

Parents
No Data
Reply
  • 12875
    posted

    Hi,

     

    I would expect that you would get an error when you try to set the SelectedValue on client side.  I believe the SelectedValue property cannot be set declaratively, the way you are trying to do it in html. 

     

    If you are trying to set the initial value you could assign the SelectedItemIndex or the SelectedValue server side in the dropdown load event.

    Marianne

Children
No Data