Using VS 2005, ASP.NET AJAX 1.0 and AJAX Toolkit 10618
I have 2 dropdowns using the Cascading Dropdown from the toolkit, these are both connected to a web service and this all seems to work fine. No other Ajax type controls are being used on the page.
How do I set the dropdown values from server side code? or any method to change the selected item in each dropdown once they have been set.
I did manage to get the selected value to pass in with the data from the callbacks on the web service and this works fine when the page first opens, but any attempt to change the selected values once the page is open either through the web service or server code does not work; both drop downs keep their previous setting. I have setup a breakpoint on the data (in the web service) before it is sent back to the page and I can see the item that should be selected but yet the dropdowns do not change their selected value.
I have tried combobox.selectedvalue = "Some Value" and the GetTargetProperties method doesn't seem available anymore.
I have this nagging suspicious feeling I am missing something obvious.
Please Help
This video has a walk though.
http://asp.net/learn/videos/view.aspx?tabid=63&id=77
I had used the information in this video to get started which was a great help.
Now I need to now how to set a selected value in the dropdowns. I can get the values set on the initial page load, it is changing the values once the page is loaded and the initail values have been set. The setting of the selected values are done through code. It seems that the dropdowns have a memory once their intial selected values are set and cannot be changed.
figured it out!
Had a look at the toolkit source code and it was obvious...
cascadingdropdown1.clientstate = "String of selected value"
All is good in the world again!
Turns out SelectedValue works as well. I was trying to do this on the dropdown itself instead of the cascading control.
No comments:
Post a Comment