Re: ASP Dropdownlist events

  • Thread starter S. Justin Gengo
  • Start date
S

S. Justin Gengo

Kerri,

Use the drop down's SelectedIndexChanged Event.

You should also set some type of text as the first item such as "Please
Select". If you don't the user won't be able to fire the event for the first
item in the list because the index won't be able to be changed to it (The
first time at least).

Then use a required field validator to keep the user from selecting the
"Please Select" entry. Do so by setting the required field validator's
InitialValue property to: "Please Select".

Sincerely,

--
S. Justin Gengo, MCP
Web Developer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
 
K

Kerri

Thanks for that.

Thats what I currently have.

Yet my click event is not being called.

Here is my drop down..


<asp:DropDownList id="selCountry" Runat="server"
style="width: 140px">

<asp:ListItem value="US"
selected="True">US</asp:ListItem>

<asp:ListItem value="Canada">Canada</asp:ListItem>

<asp:ListItem value="Other">Other</asp:ListItem>

</asp:DropDownList>


and here is the event...


Sub selCountry_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
selCountry.SelectedIndexChanged
If selCountry.SelectedIndex = ("Other") Then
txOther.Visible = True
End If
End Sub

Any ideas??
 
S

S. Justin Gengo

Kerri,

Are you posting back with a button or using the drop down's auto post back?

--
S. Justin Gengo, MCP
Web Developer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top