duck
duck

Reputation: 857

TextChanged Event is not firing

In my single web application, only the Page_Load(...) event is firing. I've tried using the text change event below (auto generated by double clicking the textbox):

protected void txtBuyerExtension_TextChanged(object sender, EventArgs e)
{
    // do something
}

But nothing happens. It does that for every control... the only event that fires is Page_Load. How come it is doing this?

Upvotes: 0

Views: 2253

Answers (3)

Saurabhchauhan232
Saurabhchauhan232

Reputation: 89

<asp:TextBox ID="txtSearch" CssClass="textbox1" placeholder="Search.." AutoPostBack="true" runat="server" 
                            OnTextChanged="txtSearch_TextChanged"></asp:TextBox>

Upvotes: 0

Anuraj
Anuraj

Reputation: 19598

You need to set the AutoPostBack property to enable TextChange event.

<asp:TextBox ID="txtBuyerExtension" runat="server" OnTextChanged="txtBuyerExtension_TextChanged" AutoPostBack="True"></asp:TextBox> 

And once you change the focus from TextBox this event will fire.

Upvotes: 1

Kaizen Programmer
Kaizen Programmer

Reputation: 3818

Add AutoPostBack="True"

<asp:TextBox ID="txtBuyerExtension" runat="server" OnTextChanged="txtBuyerExtension_TextChanged" AutoPostBack="True"></asp:TextBox> 

Upvotes: 2

Related Questions