1
Reply

Text_Changed in web form

hector_busto

hector_busto

Nov 10 2004 3:44 PM
1.9k
Hello. I have a web C# project with a form with many text boxes and two buttons, the first one is to make data search and the second is to register info in a database. I wish to execute the event click of the first button when I press ENTER in any text box, so I use this code in the event Text_Changed of each text box: private void txtFirstName_TextChanged(object sender, System.EventArgs e) { if (this.txtFirstName.Text != "") this.btnSearch_Click(null,null); } private void txtLastName_TextChanged(object sender, System.EventArgs e) { if (this.txtLastName.Text != "") this.btnSearch_Click(null,null); } ... It's working well for the search button, but when I wish to register a person, if I click the register button, it fires the Text_Changed event of the text boxes and executes the validation code of the search button. Any idea would be appreciated. Thanks a lot.

Answers (1)