ListBox SelectedIndex is always -1

S

S. Justin Gengo

HB,

You're probably databinding the list box on every page load which is
resetting it before you can get the selected value.

Put:

If Not IsPostBack Then
'---Datbind list box here
End If

Into your code and you'll get the selected value.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
 
H

HB

Guys,

PLS tell my why the ListBox SelectedIndex is always -1?, I am sure selection
was made.

Thanks

HB
 
H

HB

Many Thanks

S. Justin Gengo said:
HB,

You're probably databinding the list box on every page load which is
resetting it before you can get the selected value.

Put:

If Not IsPostBack Then
'---Datbind list box here
End If

Into your code and you'll get the selected value.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

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,225
Members
46,815
Latest member
treekmostly22

Latest Threads

Top