Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dropdownlist - selected value 1

Status
Not open for further replies.

rac55

Programmer
Jul 1, 2003
62
AU
Hi

I have a dropdownlist that is populated from the database. It contains a list of departments. When a user selects department Production, I need a textbox to be displayed. So I need the dropdownlist to be passed to a function and then to javascript. Does anyone have any ideas how to check that department production has been selected?

code is;

<asp:DropDownList class="spoilageTxtBox" id="lstDepartments" runat="server" DataValueField="DeptID" DataTextField="Department" rows="1" OnSelectedIndexChanged="PopulateContacts" AutoPostBack="True"></asp:DropDownList>

Dim objDR as OleDbDataReader
objDR = objCmdDept.ExecuteReader()


if lstDepartments.SelectedValue = "Maintenance"

response.write ("You selected2 " & lstDepartments.SelectedItem.Text)
end if

lstDepartments.DataSource = objDR
lstDepartments.DataBind()
lstDepartments.Items.Insert(0, new ListItem("-- Select a Department --"))

Thanks
 
I would use the SelectedIndexChanged event to set the text or visability of a ASPTextBox.

Private Sub lst_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lst.SelectedIndexChanged
txt.Text = lst.SelectedValue
txt.Visible = True
End Sub


Hope everyone is having a great day!

Thanks - Jennifer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top