473,395 Members | 1,975 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Highlighting DropDownList Items

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
Dec 16 '05 #1
4 1825
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
Dec 16 '05 #2
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/micro...50894f4b2232c8
--
Rob Schieber
Dec 16 '05 #3
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
"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

Dec 16 '05 #4
Joe
Thanks.
--
Joe

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/micro...50894f4b2232c8
--
Rob Schieber

Dec 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Stanley J Mroczek | last post by:
How do you load a dropdownlist when edit is clicked in a datagrid ? <Columns> <asp:BoundColumn DataField="OptionDescription" ItemStyle-Wrap="True" HeaderText="Option...
4
by: DotNetJunky | last post by:
I have built a control that runs an on-line help system. Depending on the category you selected via dropdownlist, it goes out and gets the child subcategories, and if there are any, adds a new...
3
by: mg | last post by:
I have a DataGrid (WebForm - C#) that has a template column that contains a dropdownlist named "DdlTest" In DataGrid1_UpdateCommand, the lin DropDownList ddlTest = (DropDownList)...
10
by: dhnriverside | last post by:
Hi guys Still having a problem with this dropdownlist. Basically, I've got 4. The first 2 work fine, then my code crashes on the 3rd. ddlEndTimeHour.Items.FindByValue(endTime).Selected =...
8
by: tshad | last post by:
Can you databind a dropdownlist to another dropdownlist? I have 2 identical list. I am getting my data from a DataReader, so as soon as I have bound the first DDL, I can't do it again to the next...
0
by: Daniel Doyle | last post by:
Hello and apologies in advance for the amount of code in this post. I've also sent this message to the Sharepoint group, but thought that ASP.NET developers may also be able to help, even though...
10
by: ads | last post by:
hi, after binding the dropdownlist to a datasource, ive experience this error "Cannot have multiple items selected in a dropdownlist" after using the code:...
1
by: Brett | last post by:
I have a DropDownList in an ASP.NET web form that is populated with items from a lookup table by binding that DropDownList to a SqlDataSource. However, the items in the lookup table can change over...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.