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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T16:41:24+00:00 2026-05-19T16:41:24+00:00

I have created dynamic controls in ASP.NET as following .. first i have created

  • 0

I have created dynamic controls in ASP.NET as following ..

first i have created checkbox as

 CheckBox chkDynamic = new CheckBox(); 

Then

 TextBox txtDynamic = new TextBox();
 txtDynamic.ID = "txtDynamic";

and these controls added in tablecell added in tableRow added in Table added in aspPanel(Only panel created at design page)

Now what i need.. when checkbox is selected i want to clear the txtDynamic Textbox using JavaScript

I tried following ways but not working..

 chkDynamic.Attributes["onclick"] = "javascript:document.getElementById('" + txtDynamic.UniqueID + "').value='';";

also i tried with calling Method as

 chkDynamic.Attributes.Add("onclick", "javascript:ClearText(this)");

but in this method following line giving me error not found “txtDynamic”.. because the control added dynamicaly.

 document.getElementById("<%= txtDynamic.ClientID %>").value="";

Thanks in advance….

  • 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-19T16:41:24+00:00Added an answer on May 19, 2026 at 4:41 pm

    After lots of debug i fond the answer. What does ASP.Net do at the run time it changes the ClientID of the control with attaching the parent control some prefix so before i added the entire table at the end of the all the TR created now what i did to solve this i have added the table to panel as plDynamicControls.Controls.Add(tblGeneralControls); then i added following code and it works like charm

    chkDynamic.Attributes["onclick"] = string.Format("yearSuffixCHK(this, '{0}')", txtDynamic.ClientID);
    txtDynamic.Attributes["onchange"] = string.Format("yearSuffixTXT(this, '{0}')", chkDynamic.ClientID);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have textbox controls that are created dynamically in the ASP.NET. I want to
I have a reporting module (C# asp.net) that uses dynamic controls to represent the
I have a problem with dynamic controls. In Button1 postback I created several TextBox
I have a dynamically created TextBox in a C#/ASP.NET web page that I want
I have created a web page (ASP.NET) that includes a stylesheet to mimic Dynamics
I have a reporting module in an ASP.NET webforms app (C#) that uses dynamic
I have a listview that loads dynamic controls from xml/xslt <asp:ListView ID=DynamicFields runat=server DataSourceID=CustomFields
i have to create one asp.net mvc page that will show template of controls.
I have a product admin web site that has been generated using ASP.NET Dynamic
I am creating an dynamic controls I have an drop down with options Textbox,

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.