[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.5

Get value from cascading dropdown list on postback

Asked by cg_medistox in Programming for ASP.NET, .NET Framework 3.x versions, Microsoft Visual Basic.Net

Tags: asp.net, ajax, cascading drop down, drop down, vb.net

I am trying to obtain the value of a drop down list populated client side by a cascading drop down and cannot seem to get the selected vaue

I have seen examples where the cascading drop down is added to page_init to let the page know you want to maintain state but this is doing nothing.

I must say that the whole code is inside a user control if it makes any difference

All I want to do is get the selected value from the drop down??

I am using vb.net, vs 2008, .Net 3.5 SP1. I am using the ajax toolkit from asp.net for the controls and system.web.extensions 3.5
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
'The button that launces the code, this is in the code behind
Public Sub saveProfilePeriod_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles saveProfilePeriodBtn.Click
        Dim CP As New CarProfile
        CP.ContractPeriodID = makeListExtender.SelectedValue
 
        CP.Deposit = carDeposit.Text
        CP.Ongoing = carOngoing.Text
 
        DB.CarProfiles.InsertOnSubmit(CP)
        DB.SubmitChanges()
        newContractPeriodContainer.Update()
 
    End Sub
 
This is the update panel with the cascading drop down in where I can not get the posted value
<asp:UpdatePanel ID="newContractPeriodContainer" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
                    <ContentTemplate>
                    <table class="formTable">
                        <tr>
                            <th>Contract Period: </th>
                            <td><div id="contractDropContainer">
                                    <asp:DropDownList ID="ContractPeriodsDrop" runat="server" />
                                    <cc1:CascadingDropDown ID="contractPeriodExtender" runat="server" />
                            </td>
                            <td><a href="javascript: hideContainer('newContractPeriod')">Add new contract period</a></td>
                        </tr>
                        <tr id="newContractPeriod" style="display:none">
                            <td></td>
                            <td>
                                <asp:TextBox ID="contractPerdiodText" runat="server" class="formSmallTextBox" /> months&nbsp;
                                <asp:button CssClass="btnSave" ID="saveContractPeriod" runat="server" OnClick="saveContractPeriod_Click" Text=" " />
                            </td>
                            <td></td>
                        </tr>
                        </table>
                    
                <table class="formTable">
                    <tr>
                        <th>Profile: </th>
                        <td><div id="profileDropContainer">
                                <asp:DropDownList ID="profilesList" runat="server">
                                
                                </asp:DropDownList>
                                <cc1:CascadingDropDown ID="profileListExtender" ServicePath="~/AdminEventHandlers.asmx" 
                                    ServiceMethod="GetCarProfiles" ParentControlID="ContractPeriodsDrop" TargetControlID="profilesList" PromptText="Select Profile" 
                                    runat="server" Category="Profiles"></cc1:CascadingDropDown>
                            </div>
                        </td>
                        <td><a href="javascript: hideContainer('addProfileContainer')">Add new profile</a></td>
                    </tr>
                    <tr id="addProfileContainer" style="display:none">
                        <td></td>
                        <td>
                            <asp:TextBox ID="carDeposit" runat="server" class="formSmallTextBox" />+
                            <asp:TextBox ID="carOngoing" runat="server" class="formSmallTextBox" />
                            <asp:button CssClass="btnSave" ID="saveProfilePeriodBtn" runat="server" OnClick="saveProfilePeriod_Click" Text=" " />
                        </td>
                        <td></td>
                    </tr>
                </table>
                </ContentTemplate>   
                    <Triggers>
                        <asp:AsyncPostBackTrigger ControlID="saveContractPeriod" />
                        <asp:AsyncPostBackTrigger ControlID="saveProfilePeriodBtn" />
                    </Triggers>     
                </asp:UpdatePanel>
 
'This is the page init where the cascading drop down is loaded, this works from a webservice
 Private Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
 
            contractPeriodExtender.ServicePath = "~/AdminEventHandlers.asmx"
            contractPeriodExtender.TargetControlID = "ContractPeriodsDrop"
            contractPeriodExtender.PromptText = "Select Contract Period"
            contractPeriodExtender.Category = "ContractPeriods"
            contractPeriodExtender.ServiceMethod = "GetContractPeriods"
 
 
    End Sub
 
Related Solutions
Keywords: Get value from cascading dropdown li…
 
Loading Advertisement...
 
[+][-]04/23/09 06:14 AM, ID: 24214595Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zones: Programming for ASP.NET, .NET Framework 3.x versions, Microsoft Visual Basic.Net
Tags: asp.net, ajax, cascading drop down, drop down, vb.net
Sign Up Now!
Solution Provided By: GiftsonDJohn
Participating Experts: 2
Solution Grade: A
 
[+][-]04/23/09 06:19 AM, ID: 24214647Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04/23/09 06:20 AM, ID: 24214655Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091021-EE-VQP-81 - Hierarchy / EE_QW_3_20080625