Cascading Drop Down : Selecting Value from Code Behind

I've been working with Cascading Drop Down's, which work great, but I would like to be able to select a value from the first drop down, have it populate and then select the other value from the second drop down. All from codebehind.

Anyone have any ideas on how to get this working?
directxBOBAsked:
Who is Participating?
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.

DhaestCommented:
C#.NET Articles -Cascading DropDownList Populate dropdown based on selection of other dropdown in ASP.NET
http://csharpdotnetfreak.blogspot.com/2009/03/populate-dropdown-based-selection-other.html
0
EspavoCommented:
I do it like this:
If Not Session("CountryID") Is Nothing Then mCountryDropDownList_CascadingDropDown.SelectedValue = Session("CountryID")
 
Here's my DDL
=============
 
                 <asp:DropDownList ID="mCountryDropDownList" runat="server" style="width: 155px" CssClass="Form">
                </asp:DropDownList>
                <cc2:CascadingDropDown ID="mCountryDropDownList_CascadingDropDown" 
                    runat="server" Category="Country" LoadingText="Fetching list... please wait..." 
                    PromptText="- Country -" ServiceMethod="GetCountry" 
                    ServicePath="~/AreaMainService.asmx"
                    Enabled="True" TargetControlID="mCountryDropDownList">
                </cc2:CascadingDropDown>
 

Open in new window

0
directxBOBAuthor Commented:
Where are you putting :

If Not Session("CountryID") Is Nothing Then
mCountryDropDownList_CascadingDropDown.SelectedValue = Session("CountryID")


I have put this in my PageLoad but it's not working.
 
0
EspavoCommented:
I do it like this:
 

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
 
If Not IsPostBack Then
    If Not Session("CountryID") Is Nothing Then mCountryDropDownList_CascadingDropDown.SelectedValue = Session("CountryID")
End If
End Sub

Open in new window

0

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
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
ASP.NET

From novice to tech pro — start learning today.