Solved

List Box:  First line selected when page loads.

Posted on 2012-03-15
2
346 Views
Last Modified: 2012-03-25
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
Comment
Question by:jordanhelen
  • 2
2 Comments
 
LVL 14

Expert Comment

by:systan
ID: 37726174
listbox1.selectedindex = 0
0
 
LVL 14

Accepted Solution

by:
systan earned 500 total points
ID: 37726198
or  
      Listbox1.Items.Insert(0, "")
      Listbox1.SelectedIndex = 0
      Listbox1.Select()
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
This video discusses moving either the default database or any database to a new volume.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now