Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 360
  • Last Modified:

List Box: First line selected when page loads.

I have a List Box on a web page as described below:
         
Robert
Marilyn
Candace
June
Justin

The first line of the list box is blank, indicated by the below code

ListItem li3 = new ListItem("", "0");

I need the blank line to have the focus when the web page opens.
That is, the blank line will be selected when the page loads without the user selecting it.

Any help is greatly appreciated.

Thanks!
0
jordanhelen
Asked:
jordanhelen
  • 2
1 Solution
 
systanCommented:
listbox1.selectedindex = 0
0
 
systanCommented:
or  
      Listbox1.Items.Insert(0, "")
      Listbox1.SelectedIndex = 0
      Listbox1.Select()
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now