Is there a OnExit or Leave event on ASP.NET textbox?
I need to run some code on server when user leaves the Textbox, it will do some calculations on what has been typed. I'd rather avoid doing it with jQuery, because it would involve creating a JSON server, etc.
Isn'开发者_如何学编程t there a way to do a postback for such an event?
The TextBox has an AutoPostBack property to cause a postback when the user leaves the client-side textbox. There you can use the TextChanged event to call some serverside code.
What about the Textchanged Event
of the Textbox? It is fired when we input/change some text and then leave the textbox.
This solution works for me:
<asp:TextBox ID="txtPara" runat="server" AutoPostBack="True"
OnTextChanged="txtPara_TextChanged" onblur ="myFunction()"></asp:TextBox>
<script>
function myFunction() {
__doPostBack("<%=txtPara%>", **txtPara_TextChanged**);
}</script>
精彩评论