简体   繁体   中英

How to change text box text by click on button

Hello I am beginner in asp.net webforms and i want to copy text of textbox in another textbox when i click in button

my code is:

protected void Button2_Click(object sender, EventArgs e)
{
    TextBox15.Text = TextBox6.Text;
}

when i fill TextBox6 and click button nothing show in TextBox15

Try to use IsPostBack property in the pade_load event handler to prevent re-validation of the page every time you click the button.

if (!IsPostBack)
{
    //do nothing
}

By the way code of your button click will remain as it is, dont change anything of it, just write the above code on the page load.

I hope it helps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM