Avatar of jordanhelen
jordanhelen
Flag for United States of America asked on

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!
ASP.NET

Avatar of undefined
Last Comment
systan

8/22/2022 - Mon
systan

listbox1.selectedindex = 0
ASKER CERTIFIED SOLUTION
systan

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck