Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8207577
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T09:02:49+00:00 2026-06-07T09:02:49+00:00

I have dropdownlist that is dynamically created and contains a list of users. If

  • 0

I have dropdownlist that is dynamically created and contains a list of users. If the user meets a certain I apply a style attribute to highlight the user. My ListItems will all highlight correctly, except the first one on the List. This seems odd that the first will act this way and be different than the others.

    ddlSupervisorList.Items(ddlSupervisorList.Items.Count - 1).Attributes.CssStyle.Value = "background:#cc66ff;"

If I select another user, the newly selected user will still maintain their highlight, but the first user will still not highlight.

I have even tried doing the following:

If ddlSupervisorList.SelectedItem.Equals(ddlSupervisorList.Items(ddlSupervisorList.Items.Count - 1)) Then
   ddlSupervisorList.SelectedItem.Attributes.CssStyle.Value = "background:#cc66ff;"
End If

but it will still not highlight the first item(default item) on load.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T09:02:52+00:00Added an answer on June 7, 2026 at 9:02 am

    Ultimately I went with using Some JQuery and javascript to fix the issue. I picked up the drop down list ID and got the selected option. If it was supposed to be highlighted ‘availableSelected’ was the cssclass, then I added it to the drop down list’s css for the list row.

    var userClientId = '#<%= ddlSupervisorList.ClientID %>';
    var selectedId = userClientId + ' option:selected';
    function clientIdChanged() 
    {
        if ($(selectedId).hasClass('availableSelected')) {
            $(userClientId).addClass('availableSelected');
        }
        else {
            $(userClientId).removeClass('availableSelected');
        }
    }
    $(document).ready(function() {
        clientIdChanged();
        $(userClientId).bind('change', clientIdChanged);
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a page that contains some dynamically created controls (TextBox and DropDownList). When
I have a page that contains dynamically generated Dropdown List controls and I want
I have a dynamically created list that displays radio buttons next to it. When
I have a DropDownList that contains Station codes. @Html.DropDownList(Station, null, new { id =
i have a dropdownlist that populates from the sql server database. populating the list
I have a DropDownList that asks the user if he want to join the
I have a button on a form that is dynamically spawning a select list,
I have the following scenario: My page has a dropdown list that allows user
I have a dropdownlist that has the value of two columns in it... One
I have a dropdownlist that has 4 columns but only 3 are 'visible' the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.