On textbox OnTextChanged event the postback cycle triggering twice. Breakpoints on both methods to understand the issue. Here is my code sample

<form id="form1" runat="server">
    <div>
        <asp:TextBox runat="server" ID="TextBox1" OnTextChanged="TextBox1_TextChanged" AutoPostBack="true" />
    </div>
    <asp:Label ID="Label1" runat="server"></asp:Label>
</form>

Its code behind.

     public static int cycle { get; set; }
     protected void Page_Load(object sender, EventArgs e)
     {

     }
     protected void TextBox1_TextChanged(object sender, EventArgs e)
     {
        cycle++;
        Label1.Text = cycle.ToString(); 
     }

Related posts

Recent Viewed