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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:40:23+00:00 2026-06-15T11:40:23+00:00

I want to put a value in other dynamically created textbox if there is

  • 0

I want to put a value in other dynamically created textbox if there is a changes in a specific textbox that was also dynamically created. How could I possibly do this?

this is how i created the textbox:

for (int x = 0; x < dt.Rows.Count; x++)
        {
            TextBox txt = new TextBox();
            txt.Name = dt.Rows[x]["field_name"].ToString();
    txt.Text = txt.Name;
            txt.Width = 200;
            var margintx = txt.Margin;
            margintx.Bottom = 5;
            txt.Margin = margintx;

            flowLayoutPanelText.Controls.Add(txt);
        }

Here is the output of it:

enter image description here

Example if I put a value to the Mag Data, it will also pass the value to Card Number and Exp Date. How could I possibly do this?

  • 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-15T11:40:24+00:00Added an answer on June 15, 2026 at 11:40 am

    You can dynamically add an event handler to your Dynamic TextBox's TextChanged Event and since you are also using your Field Names as your TextBox Name you can cast your events sender object to determine which TextBox was changed.

    for (int x = 0; x < dt.Rows.Count; x++)
    {
        TextBox txt = new TextBox();
        txt.TextChanged += new EventHandler(txt_TextChanged);
        txt.Name = dt.Rows[x]["field_name"].ToString();
        txt.Text = txt.Name;
        txt.Width = 200;
        var margintx = txt.Margin;
        margintx.Bottom = 5;
        txt.Margin = margintx;
        flowLayoutPanelText.Controls.Add(txt);
    }
    
    void txt_TextChanged(object sender, EventArgs e)
    {
        TextBox tb = (TextBox)sender;
        if (tb.Name == "Mag Data")
        {
            //Do Stuff Here
        }
    }
    

    The issue that you are having is that your Name Property is not accessable as a TextBox i.e you can not do “Card Number”.Text you will need to search the Control Collection for the TextBox named “Card Number” you can use the Controls.Find Method to do so.

    i.e.

    if (tb.Name == "Mag Data")
    {
        Control[] cntrl = Controls.Find("Card Number", true);
        if (cntrl.Length != 0)
        {
            ((TextBox)cntrl[0]).Text = tb.Text;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

am i doing this right? i want to put the value of i.src into
I have a drop down list and I want the selected value to put
i have put fckeditor in jsp page. I want to get the value whatever
I want to break down this URL into variables. http://example.com/user.php?u=38456 I want the value
I have a page that contains dynamically generated Dropdown List controls and I want
I put some client-side Javascript in my template that allows a user to dynamically
I want to put the value of i.src into the input and then display
I want to put completion of task in percentage (eg. 24.5,88.4,12.9,100.0,etc), the maximum value
i want to put this text &euro; in the text of a dropdownlistitem, so
I want to put some Date() value in Cookies which I would like to

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.