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

  • SEARCH
  • Home
  • 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 8704107
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:01:03+00:00 2026-06-13T03:01:03+00:00

I have a <div> element that I want to dynamically add some HTML <a>

  • 0

I have a <div> element that I want to dynamically add some HTML <a> elements to. That part seems to be working just fine. Here is the HTML:

<div id="crumbBar" runat="server"/>

In my code behind, adding HTML anchors works as expected; however, when the page renders, the id is changed to ‘workArea_crumbBar’ (this is all in a master page).

I tried dynamically creating a <div> within the <div> with the appropriate id, but that also prepended the id with ‘workarea_’.

I’ve got other code that relies on the id of the <div> element. Is there some way to keep IIS from changing the id of either the main or nested element?

  • 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-13T03:01:04+00:00Added an answer on June 13, 2026 at 3:01 am

    Try to change your div like this:

    <div id="crumbBar" runat="server" ClientIDMode="Static" /> 
    

    In fact, this is not IIS but the ASP.Net Framework behavior. The controls are organized in a tree, and the final client id will be the result of the concatenation of the all the ancestors IDs.

    The goal is to avoid conflicting Id between two controls. An example of conflict is when you create a user control with, for example: <asp:label id="mylbl" runat="server" />. If you instantiate twice the user control, two controls will have the same Id on the client side without this behavior.

    That mean you have to use precautiously this attribute, at it can lead to some obscure issues. You should looks for another solution if you can. After 12 years of building .Net apps, I never have to use this attribute. There are probably alternatives.

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

Sidebar

Related Questions

I have a few div elements that i want to dynamically apply an effect
I have a script that create a new div element. Then, I want to
I have code that adds a pre-determined HTML snippet into a pre-determined <div> element
I have a basic div element to represent a message that I show for
I have a div that will serve as container to other element, I have
I have two div elements that are twins (i.e. their dimensions and contents are
I have a div element in an HTML document. I would like to extract
I have a select box that gets generated dynamically. I want to allow users
I have a bunch of links that I want to load dynamically within the
I have elements dynamically added to the div 'wrap', such as: <div id='wrap'> <div

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.