Click here to Skip to main content
15,888,461 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a textbox. i want when i have write something on textbox and when i click outside the textbox then on the basics of that value the action must be performed. which event perform on this type of problem
Posted

You can use textchanged event or Onblur event of the textbox .
 
Share this answer
 
Hi Arvind,

If you want to perform the action on client side ( ie: javascript ) you can use onblur event.

<asp:TextBox ID="txt" runat="server" onblur="javascript:dosomething()"></asp:TextBox>


JavaScript
var dosomething = function () {
    alert('you have lost the focus');
}



in server side, you can use TextChanged event,
Dont forget to put AutoPostBack=true

<asp:TextBox ID="txt" runat="server" AutoPostBack="true" OnTextChanged="txt_TextChangedEvent"></asp:TextBox>


C#
protected void txt_TextChangedEvent(object sender, EventArgs e)
       {

       }
 
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