AJAX Cascading dropdown Set a value

Hello Experts,

I have 2 dd lists and populate via a web service. And write the selected values to a SQL table.  Which works fine.

The issue is when I read from the SQL table and want to populate the dd list with the corresponding text value. the SelectedValue of the dd list is not working in the page load.

I have unique values stored in the xml (which the web services uses) for the 2dn ddl and
store the integer on the table rather than the text which is displayed in 2nd ddlist.

Do I need to store both the dd list 1 and dd list values  in sql and then create a web service function that will pre populate the the 2 dd lists based on my table values?  Or am I on the wrong track?


Any Ideas?

 I looked at the EE question/solutions but did not find any ideas.  C# if possible but will take anything!

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Two checks to be made. 1) Make sure that you handled page post back properly, that is your ddl selectvalue should be with in !ispostback. 2) set the ddl value like ddl.Items.FindByValue("stringforselectedvalue").Selected = true
nowmbieAuthor Commented:
 Well I am in the !ispostback. And I tried the FindbyValue but It seems that the ddl has no rows in it.
 I am loading it via a web service and using a CascadingDropDown AJax control extender.

It seems that  web service is not called to load the first ddl until  the user selects from the Frist ddl then the second ddl is loaded.  I am probably tired and missing something really simple. But should I create a function in the web service to load the 2 ddls? I mean is there a technique I am missing?


It seems to me that you should preserve the second ddl value in a viewstate or session and after having AJAX call to load the second ddl, you should set the value. Alternatively, while retrieving values, you should make an external call to the AJAX web service to load the details based on first ddl value and then set the second value.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
nowmbieAuthor Commented:
Thanks, What I did was load a dictionary by creating a function in the web service and calling from code behind.
if you have used update panel make sure that both the dropdown list is inside it.
also check AutoPostBack="true"
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.