Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > asp:listbox problem

Reply
Thread Tools

asp:listbox problem

 
 
Samir Sanghani
Guest
Posts: n/a
 
      08-05-2003
Hi All,

Am facing a problem with listbox control in asp.net. If the listbox has
entries which are duplicate in text value, selection of an entry down the
list causes the selectedindex property to return the least index containing
the same text even though that is not selected.

To elaborate:

if my list box contains elements in following sequence
a
b
c
a
d

on selection of the 2nd "a" the selectedindex contains value 0 instead of 3.

Has anyone faced this problem earlier? Is there any setting I could be
missing?

Thanks in advance for any help offered. A quick reply would be really
appreciated as this is causing a stand still in development.

Regards
Samir


 
Reply With Quote
 
 
 
 
Svetlin Grancharov
Guest
Posts: n/a
 
      08-05-2003
Hi Samir,
why don't you use values with these list items.
Check SelectedValue and SelectedItem properties.

Svetlin Grancharov
>-----Original Message-----
>Hi All,
>
>Am facing a problem with listbox control in asp.net. If

the listbox has
>entries which are duplicate in text value, selection of

an entry down the
>list causes the selectedindex property to return the

least index containing
>the same text even though that is not selected.
>
>To elaborate:
>
>if my list box contains elements in following sequence
>a
>b
>c
>a
>d
>
>on selection of the 2nd "a" the selectedindex contains

value 0 instead of 3.
>
>Has anyone faced this problem earlier? Is there any

setting I could be
>missing?
>
>Thanks in advance for any help offered. A quick reply

would be really
>appreciated as this is causing a stand still in

development.
>
>Regards
>Samir
>
>
>.
>

 
Reply With Quote
 
 
 
 
Samir Sanghani
Guest
Posts: n/a
 
      08-07-2003
Thanks Svetlin,

That option worked. I checked and found am not assigning any data in value
for the items. Assigning unique values there corrected the problem.

Thanks once again.
Samir

"Svetlin Grancharov" <(E-Mail Removed)> wrote in message
news:046701c35b9d$af2ef870$(E-Mail Removed)...
> Hi Samir,
> why don't you use values with these list items.
> Check SelectedValue and SelectedItem properties.
>
> Svetlin Grancharov
> >-----Original Message-----
> >Hi All,
> >
> >Am facing a problem with listbox control in asp.net. If

> the listbox has
> >entries which are duplicate in text value, selection of

> an entry down the
> >list causes the selectedindex property to return the

> least index containing
> >the same text even though that is not selected.
> >
> >To elaborate:
> >
> >if my list box contains elements in following sequence
> >a
> >b
> >c
> >a
> >d
> >
> >on selection of the 2nd "a" the selectedindex contains

> value 0 instead of 3.
> >
> >Has anyone faced this problem earlier? Is there any

> setting I could be
> >missing?
> >
> >Thanks in advance for any help offered. A quick reply

> would be really
> >appreciated as this is causing a stand still in

> development.
> >
> >Regards
> >Samir
> >
> >
> >.
> >



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem problem problem :( Need Help Mike ASP General 2 05-11-2004 08:36 AM



Advertisments