I have the TextField set to FullName and my ValueField set to PersonID. Then I do my DataBind.
When the page first comes up and I don't type anything and just scroll to myself I cget the correct SelectValue of 1. If I type in my name instead and then click on my name, the SelectdValue is 0 now.
Obviously this is unexpected behavior and is driving be batty. Am I doing something wrong?
That's what I needed, thank you!
Hi,
Thanks for attaching the sample code. I looked at it, and I think this happens because you have AutoPostBack=true. In that case for any Value or selection changed on the client, it will do a full postback.
If you set AutoPostBack to false i think it will work as expected. On the other hand, if you need to postback on selection changed you can set this specific autopostback flag :
<AutoPostBackFlags SelectionChanged="On" /> (it can also be set to Async)
Hope this helps,
Angel
I got it working by changing the filter type to client. I don't understand something still though. When I type a letter in the web drop down, it posts back several times. When I have it set to Server filtering, it posts back 3 times when I type each letter. I assume, given my code, it is losing the value due to those post backs. Can you look at the included code I have? Am I doing something incorrectly here?
Could you take a look at the sample i have attached - WebSite63.zip - It uses the same scenario that you describe, and it works fine, maybe you have some additional code or property set that introduces this wrong behavior.
Please let me know whether i can help further.
Thanks,
ddPersonList.DataSource = objPersonCore.ReturnPersonList(
)ddPersonList.TextField = "FullName"ddPersonList.ValueField = "PersonID"ddPersonList.DataBind()
I check the SelectedValue both on an update panel and also when they click the save button. I have tried both Server and Client filtering. Without fail, if the page loads and I scroll to find my name without typing, I get the correct SelectedValue. If I use the filter type ahead, I get 0 every time.