Highlighting DropDownList Items

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello All,

I am creating a DropDownList of people's names and address. Each item will
be a combination of the individual's name and address. if a person has two
addresses, his/her name will appear twice, once with the first address and
once with the second.

I need to highlight the first occurance of each name. I could bold it,
change the text color to blue or purple (or another color). The point is
that it has to stand out.

Does anyone have a suggestion on how to do this? I have tried using the
following code to hoghlight first items and have had no luck.

If FirstItemFormatted Then
li.Attributes.Add("style", "color:black")
Else
li.Attributes.Add("style", "color:blue")
FirstItemFormatted = True
End If

I would appreciate any help that you could offer.

TIA,
 
Joe said:
Hello All,

I am creating a DropDownList of people's names and address. Each item will
be a combination of the individual's name and address. if a person has two
addresses, his/her name will appear twice, once with the first address and
once with the second.

I need to highlight the first occurance of each name. I could bold it,
change the text color to blue or purple (or another color). The point is
that it has to stand out.

Does anyone have a suggestion on how to do this? I have tried using the
following code to hoghlight first items and have had no luck.

If FirstItemFormatted Then
li.Attributes.Add("style", "color:black")
Else
li.Attributes.Add("style", "color:blue")
FirstItemFormatted = True
End If

I would appreciate any help that you could offer.

TIA,

Have you looked at the html source that is generated when the page
renders? What does it show? It should look like this to accomplish
what you want:
<option style="color:blue">test</option>
 
Joe said:
Hello All,

I am creating a DropDownList of people's names and address. Each item will
be a combination of the individual's name and address. if a person has two
addresses, his/her name will appear twice, once with the first address and
once with the second.

I need to highlight the first occurance of each name. I could bold it,
change the text color to blue or purple (or another color). The point is
that it has to stand out.

Does anyone have a suggestion on how to do this? I have tried using the
following code to hoghlight first items and have had no luck.

If FirstItemFormatted Then
li.Attributes.Add("style", "color:black")
Else
li.Attributes.Add("style", "color:blue")
FirstItemFormatted = True
End If

I would appreciate any help that you could offer.

TIA,

Its a bug, Attributes.Add doesn't work and you cant inherit from it
since its sealed.

http://groups.google.com/group/micr...ListItem+sealed&rnum=3&hl=en#1c50894f4b2232c8
 
Rob,

I have looked at the source. It doesn't show the style attribute at all.

BTW, I'm using Framework 1.1.
 

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

Back
Top