Groups | Blog | Home
all groups > asp.net > january 2004 >

asp.net : Need to Search DropDown List Items


Martha[MSFT]
1/30/2004 6:17:02 PM
DrpDwnLst1.Items.Contains takes a "ListItem" as a argument and not a string.
So do something like this:

DrpDwnLst1.Items.Contains(new ListItem(newLtr))

Hope this helps,
Martha



[quoted text, click to view]

George
1/30/2004 10:56:05 PM
Using VS.NET 2002\Web Form\VB

I have a dropdown list that will contain letters of the alphabet. At
startup, it has only the letter A in the list. I add letters to the items
list, as needed. However, before I add a new letter, I need to see if the
letter is already in the list. After determing the letter that I will be
looking for:

Dim newLtr as string = "B"

I have tried to use the following in my code behind to see if that letter is
in the item list:

DrpDwnLst1.Items.FindByText(newLtr)
DrpDwnLst1.Items.Contains(newLtr)

Either of those two ways gives me that squiggle line underneath that
indicates it can't digest what I am trying to do.

I have no problems adding items, just can't seem to find a way to search the
list. Can someone tell me what I'm doing wrong?

Thanks,
George


George
1/31/2004 3:07:12 AM
Martha,

That did the trick! Thanks very much. I appreciate your time. ;-)

George


[quoted text, click to view]

AddThis Social Bookmark Button