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 3282766
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T19:57:53+00:00 2026-05-17T19:57:53+00:00

I’m working on someone else’s code and found something very interesting and hoping someone

  • 0

I’m working on someone else’s code and found something very interesting and hoping someone might know how this is happening.

In the markup file, I place a TextBox control and a DropDownList control, and assigned both of them the CssClass of InputField which changes the background color and other cool stuff.

To avoid any doubts, here are my declarations, copy-paste verbatim from the IDE:

<asp:TextBox runat="server" ID="txtCity" CssClass="InputField" />
<asp:DropDownList runat="server" ID="ddlState" CssClass="InputField" OnInit="ddlState_Init" OnLoad="ddlState_Load" />

When I execute the page, I see the rendered <input> having the correct class name.
But the <select> has a class name dropdown, which just happens to be defined in another .css file in the project, that has different style than mine of course.

Once again, verbatim from the view-source:

<input name="ctl00$ctl00$BodyContentPlaceHolder$ContentPlaceHolder1$txtCity" type="text" id="ctl00_ctl00_BodyContentPlaceHolder_ContentPlaceHolder1_txtCity" class="InputField" />
<select name="ctl00$ctl00$BodyContentPlaceHolder$ContentPlaceHolder1$ddlState" id="ctl00_ctl00_BodyContentPlaceHolder_ContentPlaceHolder1_ddlState" class="dropdown"></select>

To find out how this happens, I stepped into each of the following events:

  • Page_Init
  • Page_Load
  • ddlStates_Init
  • ddlStates_Load

and added a watch to ddlStates.CssClass.
To my shock, I found that in all the events, the value of CssClass is already changed to dropdown.

What is changing the class name so early?
Can something I don’t know about override values like this?
Even if something does change values, can it do that before the control’s Init event itself?

FYI: The page class is not inheriting from any page base class – just straight-up System.Web.UI.Page.

FYI: I made sure that I am looking at the correct ddlStates instance by adding a random attribute and verified that it retains that information in all the event step-ins I did.

Thanks.

  • 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-05-17T19:57:54+00:00Added an answer on May 17, 2026 at 7:57 pm

    There are a few things that you need to check before digging too much deeper. The first thing I would look for is a skin/theme file. These files overwrite the appearance of controls to make them feel consistent, but can play havoc when you don’t know about them. To check this just look at your page header or take a look around for any skin files.

    Here is a link with some more info on skin/theme files.

    From the above source under the section Theme Settings Precedence:

    If you set a page’s Theme property,
    control settings in the theme and the
    page are merged to form the final
    settings for the control. If a control
    setting is defined in both the control
    and the theme, the control settings
    from the theme override any page
    settings on the control. This strategy
    enables the theme to create a
    consistent look across pages, even if
    controls on the pages already have
    individual property settings. For
    example, it allows you to apply a
    theme to a page you created in an
    earlier version of ASP.NET.

    Alternatively, you can apply a theme
    as a style sheet theme by setting the
    page’s StyleSheetTheme property. In
    this case, local page settings take
    precedence over those defined in the
    theme when the setting is defined in
    both places. This is the model used by
    cascading style sheets. You might
    apply a theme as a style sheet theme
    if you want to be able to set the
    properties of individual controls on
    the page while still applying a theme
    for an overall look.

    If that isn’t the problem then I would suggest changing the name of the drop down temporarily to make sure that it isn’t being played with programmatically. If that fails then begins the long and arduous journey of debugging the hard way.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone know how can I replace this 2 symbol below from the string
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
link Im having trouble converting the html entites into html characters, (&# 8217;) i
this is what i have right now Drawing an RSS feed into the php,
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I have some data like this: 1 2 3 4 5 9 2 6
I want use html5's new tag to play a wav file (currently only supported
Seemingly simple, but I cannot find anything relevant on the web. What is the
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out

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.