SeaSide SeaSide - 1 year ago 70 Question

Is there another way to use onTextChanged for TextBox and avoid page refreshing every time?

I have a JavaScript which is doing some calculations from text fields and every time I pass on other text field JavaScript is called on action in TextBox 'onTextChanged' which require AutoPostBack = True but that every time doing refreshing of my page and because that I need every time to click twice on TextBox.

I have already tried to put this line of code on PageLoad but it still required 'AutoPostBack = True' and it also doing refreshing of page :

CType(Me.FV.FindControl("txtLP_1"), TextBox).Attributes.Add("onblur", "javascript:startCalc();")

This is how looks like code on PageLoad:

Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load

If Not IsPostBack Then

End If

CType(Me.FV.FindControl("txtLP_1"), TextBox).Attributes.Add("onblur", "javascript:startCalc();")

End Sub

Answer Source

Instead of setting AutoPostBack="True" and invoking a post back everytime a value changes in your TextBox control why don't you just handle the text changed event through jQuery(completely client side)?

<head runat="server">
    <script src=""></script>
    <script type="text/javascript">
        $(function () {
            $('#' + '<%: TextBox1.ClientID %>').on('input', function (e) {
                var value = $(this).val();
    <form id="form1" runat="server">
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download