470,588 Members | 2,127 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,588 developers. It's quick & easy.

listbox not allowing 1st selection

I have a listbox that I fill and can't select the 1st item until I select
another item first.

I have the onselectedindexchange set to a function and autopostback set to
true.

The only problem is that it doesn't go to the function if I select the first
item. It does the postback, but doesn't go to the function until I select
something else first 2nd item or greater (which goes to the
onSelectedIndexChange function. Then I can select the 1st item fine.

I tried setting Search.SelectedIndex to -1 first, but that didn't seem to
help.

Why does it do that?

Thanks,

Tom
Jan 11 '06 #1
1 1146
"tshad" <tf*@dslextreme.com> wrote in message
news:uD**************@tk2msftngp13.phx.gbl...
I have a listbox that I fill and can't select the 1st item until I select
another item first.
I tried to add the following to see what the behavior was:

SearchList.SelectedIndex = 2
trace.warn("at 1st SearchList test selectedIndex = " &
SearchList.SelectedIndex)
SearchList.SelectedIndex = -1
trace.warn("at 2nd SearchList test selectedIndex = " &
SearchList.SelectedIndex)

This came back with:

at 1st SearchList test selectedIndex = 2
at 2nd SearchList test selectedIndex = 0

After setting index to -1, it is always 0 (even though nothing is showing as
selected), so when you check it always acts as if the first one was
selected. This is a real problem.

Is there a way to set it as not selected and then how do you check if this
is the case?

Thanks,

Tom
I have the onselectedindexchange set to a function and autopostback set to
true.

The only problem is that it doesn't go to the function if I select the first item. It does the postback, but doesn't go to the function until I select
something else first 2nd item or greater (which goes to the
onSelectedIndexChange function. Then I can select the 1st item fine.

I tried setting Search.SelectedIndex to -1 first, but that didn't seem to
help.

Why does it do that?

Thanks,

Tom

Jan 11 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Dan Bass | last post: by
6 posts views Thread by Chris Leuty | last post: by
5 posts views Thread by Dave H | last post: by
reply views Thread by Sanjin | last post: by
9 posts views Thread by zdrakec | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.