Selecting a Vehicle Type from a Drop Down List

jjc9809
jjc9809 used Ask the Experts™
on
Hi Everyone,

I have a web application that I am working on.  I have populated the VehicleType_vch dropdown list with T Sequel code using a select statement when the application runs.

When the user selects a Vehicle type called Boat, I want other drop downs to appear and become visible based on the selection by ther user with the VehicleType_vch Drop Down List.

Where do I place the coding to  handle this event?  Do I place in the Selected IndexChanged event or TextChanged event or some other place?  When I run  the coding below nothing happens, so I have something wrong.

My coding:

Protected Sub DDLVehicleType_vch_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DDLVehicleType_vch.SelectedIndexChanged
        If DDLVehicleType_vch.SelectedItem.ToString = "Boat" Then
            LblBoatState.Visible = True
            DDLState.Visible = True
        End If
    End Sub

jjc9809
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
Set a break point on the IF... and let us know if your code is reaching the "if" statement and than as next if "yes" let us know if the objects can be initialized?

Question is in a protected procedure are the obejcts you asking for are known? Maybe for testing, try it public.

Hope this will help you.
Senior .Net Developer
Commented:
Set your autopostback = true for your DDLVehicleType
i just hope that you have set autopostback="true":-
<asp:DropDownList runat="server" ID="ddlTest" AutoPostBack="True" 
                onselectedindexchanged="ddlTest_SelectedIndexChanged">
    </asp:DropDownList>

Open in new window

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial