Home All Groups Group Topic Archive Search About

Highlighting DropDownList Items

Author
16 Dec 2005 7:20 PM
Joe
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

VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation

Author
16 Dec 2005 7:38 PM
Rob Schieber
Joe wrote:
Show quoteHide quote
> 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>

--
Rob Schieber
Are all your drivers up to date? click for free checkup

Author
16 Dec 2005 7:58 PM
Joe
Rob,

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

BTW, I'm using Framework 1.1.

--
Joe

VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation


Show quoteHide quote
"Rob Schieber" wrote:

> Joe wrote:
> > 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>
>
> --
> Rob Schieber
>
Author
16 Dec 2005 7:57 PM
Rob Schieber
Joe wrote:
Show quoteHide quote
> 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/microsoft.public.dotnet.framework.aspnet.webcontrols/browse_thread/thread/cb1b9cf510877c1e/1c50894f4b2232c8?lnk=st&q=ListItem+sealed&rnum=3&hl=en#1c50894f4b2232c8


--
Rob Schieber
Author
19 Dec 2005 1:25 PM
Joe
Thanks.
--
Joe

VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation


Show quoteHide quote
"Rob Schieber" wrote:

> Joe wrote:
> > 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/microsoft.public.dotnet.framework.aspnet.webcontrols/browse_thread/thread/cb1b9cf510877c1e/1c50894f4b2232c8?lnk=st&q=ListItem+sealed&rnum=3&hl=en#1c50894f4b2232c8
>
>
> --
> Rob Schieber
>

Bookmark and Share