|
.net
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Highlighting DropDownList ItemsI 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 Joe wrote:
Show quote > Hello All, Have you looked at the html source that is generated when the page > > 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, renders? What does it show? It should look like this to accomplish what you want: <option style="color:blue">test</option> -- Rob Schieber Rob,
I have looked at the source. It doesn't show the style attribute at all. BTW, I'm using Framework 1.1. -- Show quoteJoe VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation "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 > Joe wrote:
Show quote > Hello All, Its a bug, Attributes.Add doesn't work and you cant inherit from it > > 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, 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 Thanks.
-- Show quoteJoe VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation "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 > |
|||||||||||||||||||||||