Link to home
Start Free TrialLog in
Avatar of directxBOB
directxBOBFlag for Ireland

asked on

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?
Avatar of Dirk Haest
Dirk Haest
Flag of Belgium image

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
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

Avatar of directxBOB

ASKER

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.
 
ASKER CERTIFIED SOLUTION
Avatar of Espavo
Espavo
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial