0

Possible Duplicate:
Lost Focus method for asp.net textbox?

i want to check the data entered by user on the client side. it is necessary for me to use control. is there any way so that i can check after client move on to the next input and i can check the data by javascript ?

<asp:TextBox ClientIDMode="Static" onblur="return userCheck(this.id)" onkeyup="return userCheck(this.id)"
                        ID="txtUserName" runat="server" Width="180"></asp:TextBox>

here i have used two events but i want to use only one.

Community
  • 1
  • 1
Hardik Fefar
  • 301
  • 4
  • 19

2 Answers2

3

You can do that with onblur event using javascript. f.e something like that:

<asp:TextBox runat="server" onblur="Javascript:alert('1234');" />
Farhad Jabiyev
  • 26,014
  • 8
  • 72
  • 98
0

For what you want to do, you can set the textbox to have AutoPostBack=True; any time the text in the box is changed and the box loses focus, it will post back to the page; you can use the TextChanged property, as well, if you don't want to post back, which will check to see if the text of the TextBox has been changed between posts.

Finally, you can bind the JavaScript onFocus and onBlur events to the textbox, and handle changes to its contents via JavaScript:

http://support.microsoft.com/default.asp…

Source: http://answers.yahoo.com/question/index?qid=1006040618831

Yasser Zamani
  • 2,380
  • 21
  • 18