Solved

List Box:  First line selected when page loads.

Posted on 2012-03-15
2
348 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
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…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

895 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

11 Experts available now in Live!

Get 1:1 Help Now