Click here to Skip to main content
15,944,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

I have here one problem.

I have a textbox
<asp:TextBox ID="txtLoanNumber" SkinID="text" runat="server" MaxLength="15" Onblur="checkLoanNum();">

here i am using onblur but when i insert a value in text box and then quickly click on save btn then it save information of textbox and after it call onblur event,
i.e. it will call onblur after click on save btn,
but i dont want that...
I want to execute a script when i insert a value in textbox.

Please give a solution...
Updated 27-Nov-11 19:30pm

Your onblur called after button click ?

may be your checkLoanNum() function returns true and it will button click.
give return before function name.

<asp:TextBox ID="txtLoanNumber" SkinID="text" runat="server" MaxLength="15" Onblur="return checkLoanNum();">
Share this answer
RaisKazi 28-Nov-11 2:26am    
My 5. As I too think probably JavaScript function is returning "true" which is giving a impression to OP that Server-Side event executing first.
Client-Side/JavaScript Events are always executes before Server-Side Events. As mentioned in "Solution 1" probably your JavaScript Function is returning true(by default which is true) and then your Server-Side Event is executing.

You can also check by putting alert in your JavaScript function.

Also you may use onchange JavaScript Event as an alternate to Onblur.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900