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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:39:04+00:00 2026-05-26T21:39:04+00:00

I have been getting some massive head aches working on a very dynamic app.

  • 0

I have been getting some massive head aches working on a very dynamic app.

I am using a dynamic placeholder control from:

http://www.denisbauer.com/ASPNETControls/DynamicControlsPlaceholder.aspx

This saves me a lot of hassle when trying to re-create dynamically created controls after a postback.

Has anyone else had any issues with attaching a event handler to checkbox control?

Here is my code for the dynamically created checkbox.

// Now I create my checkbox
chkDynamic = new CheckBox();
string chk = "chk";

// Add it to our dynamic control
chkDynamic.CheckedChanged += new EventHandler(chkDynamic_CheckedChanged);
chkDynamic.ID = chk;
DynamicControlsPlaceholder1.Controls.Add(chkDynamic);
chkDynamic.Text = "hey";

This works, but its like the event is not getting attached!
Here is my event handler!

protected void chkDynamic_CheckedChanged(object sender, EventArgs e)
    {

    if (((CheckBox)sender).Checked)
        Response.Write("you checked the checkbox :" + this.chkDynamic.ID);
    else
        Response.Write("checkbox is not checked");
}

Now if I was to use a regular placeholder or a panel this works great.

Ex. Change this line:

DynamicControlsPlaceholder1.Controls.Add(chkDynamic);

to

Panel1.Controls.Add(chkDynamic);

And it works perfect.

Could someone please tell me, is this an issue with this control, or my coding?

There are no errors, the only thing that is happening that is unexpected is my event is not firing when I’m using the DynamicControlsPlaceholder.

  • 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-26T21:39:05+00:00Added an answer on May 26, 2026 at 9:39 pm

    If you are adding dynamic controls, you MUST create/recreate the controls no later than OnInit(). This is the point in the .NET page lifecycle where the viewstate and events are restored. If it is solely for the purpose of adding dynamic controls that you are using the dynamic placeholder control, then simply putting the control creation/recreation in OnInit() will solve your problem. Give it a try and let me know your results.

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

Sidebar

Related Questions

I have been working on a project in scala, but I am getting some
I've been getting some odd behavior using a foreach today. I have a dataset
I have been getting some weird errors when I upgrade jQuery from 1.4.4 to
I have been getting null returns from findViewbyID for some hours now. I've been
I recently have been getting more into C++. I have done some (very minimal)
I have been using Visual Studio 2008 quite long but lately I am getting
I have been getting this error message when I step into some methods Do
Ok now I am confused. I have been getting advice from SO users on
We have been using weborb for .net on an existing application for some time
I have been getting this error for quite some time now and Google has

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.