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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T16:45:30+00:00 2026-05-11T16:45:30+00:00

Previously Called: How to deal with dynamically created controls under load in aspx in

  • 0

Previously Called: How to deal with dynamically created controls under load in aspx

in response to a question below: the information required to determine which controls to restore is contained in a dedicated viewstate object.

I am dynamically creating controls in the codebehind page – these controls are all hooked up to click handlers so when a postback occurs I must re-create the previous set of controls, then clear the controls down and generate the new set of controls based on the previous click.

This is coded and working correctly under normal circumstances esentially as follows:

in Page_Load
if not postback generate default buttons 
else if postback re-generate buttons that were shown on last page

in click_handler
Clear the dynamically generated buttons created in the Page_Load
generate new buttons based on the specific click being handled

however when the server comes under load we start getting problems:

With 5 users per second we start getting the exception:
Multiple controls with the same ID ‘add0’ were found. FindControl requires that controls have unique IDs.

With 100 users per second we start getting the exception:
The control collection cannot be modified during DataBind, Init, Load, PreRender or Unload phases.

Once this occurs all subsequent requests get the same error and IIS has to be re-started.

What could be causeing this and how can I avoid it? Do html requests possibly overwrite and interfere with each other when under load? do objects somehow hand around after a page unload in a manner that would allow the next page load to trip over them?

  • 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-11T16:45:30+00:00Added an answer on May 11, 2026 at 4:45 pm

    A private static variable was being used to store a dictionary of names and table cells so that table cells would not get re-created during the page lifecycle.

    The key point is that it was marked static – it should have been an instance variable – the end result being that under load when requests started backing up then multpile requests were sharing this static dictionary.

    exactly what happened i’m not 100% sure – but under medium loads FindControl would find multiple controls of the same name, under very high loads it seems one request would try to modify a control (probably add to it) while it was in an invalid state from the other request.

    End result – if you dont really know what your doing – prefer instance variable sto static variables.

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

Sidebar

Ask A Question

Stats

  • Questions 257k
  • Answers 257k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer No, you do not have to check. Session.getTransaction will initiate… May 13, 2026 at 10:48 am
  • Editorial Team
    Editorial Team added an answer IE and firefox implement tags differently. In IE, what you… May 13, 2026 at 10:48 am
  • Editorial Team
    Editorial Team added an answer Have you tried: $(form).ajaxSubmit(....); Two things there: 1) I think… May 13, 2026 at 10:48 am

Related Questions

I'm finding myself writing a lot of spaghetti in Javascript when I have to
I'm looking for possible ways to persist the following classes. Subsonic SimpleRepository looks like
A followup to this question, Building select projects only with Team Foundation Build :
I have cron job - php script which is called one time in 5

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.