Click here to Skip to main content
15,867,488 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to use textchanged event without page refresh
Posted
Comments
Jim Jos 17-May-12 7:19am    
I assume this asp.net? Page refresh happens only when the even is runat=server when the event is only a javascript event no refresh happens? Please clarfiy
tanweer 17-May-12 7:25am    
using jQuery KeyDown it will be possible

You need to use the Update panel[^] and wrap the control in update panel to which you perform any event without page refresh.

hope it helps :)
 
Share this answer
 
Using javaScript attach handler to onchange event and do your processing there.

If you need server-side processing use Solution 1.
 
Share this answer
 
v2
use update panel like this

XML
<asp:UpdatePanel ID ="updt1" runat ="server" >
       <ContentTemplate >

       <asp:TextBox ID="txt" runat ="server" >
       </asp:TextBox>

       </ContentTemplate>
       <Triggers >
       <asp:AsyncPostBackTrigger ControlID ="txt" EventName ="TextChanged" />
       </Triggers>
       </asp:UpdatePanel>

in code behind:
VB
Protected Sub txt_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles txt.TextChanged
       Response.Write("hai")
   End Sub
 
Share this answer
 
Comments
Member 9244696 11-May-14 5:03am    
i've test this but doesnt work?????
Use Javascript in code-behind

on page load in .cs file
C#
txtBox.Attributes.Add("onblur", "return doSomethingInJavascript()");




//javascript
C#
<script type="text/javascript" language="javascript">
function doSomethingInJavascript()
   {
       var Form = document.frmName;
       var Max = Form.txtBox.value;
       alert(Max );
   }
</script>
 
Share this answer
 
Please use AJAX TOOLKIT.

In that please include Scriptmanager, Updatepanel, content template
 
Share this answer
 
Hi,

You can use javascript for this.

<asp:TextBox ID="TextBox1" runat="server onchange="javascript:return TextChangedChange();"/ >

fnction TextChangedChange(){
//Put your code
}

Happy Coding :)
 
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