Reputation: 857
I have 2 textboxes: txtSKU1 and txtDescription1. I want the user put text into txtSKU1, then hit tab and have the txtSKU1_TextChanged event fire, which will auto populate txtDescription1. I'm trying to avoid using a postback. From my understanding, the TextChanged event fires after it loses focus, so I assumed the UpdatePanel I used below would work but nothing happens until I do a trigger a postback. Any ideas?
<td><asp:TextBox ID="txtSKU1" runat="server" width="100%" BorderColor="#dddddd" OnTextChanged="txtSKU1_TextChanged"></asp:TextBox></td>
<td>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:TextBox ID="txtDescription1" runat="server" width="100%" BorderColor="#dddddd"></asp:TextBox>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="txtSKU1" EventName="TextChanged" />
</Triggers>
</asp:UpdatePanel>
</td>
Upvotes: 0
Views: 8287
Reputation: 6916
The problem isn't the UpdatePanel, it's just that the TextChanged
event is one that only fires during a postback that's been triggered by something else.
To get TextChanged
to trigger the postback, set its AutPostBack
attribute:
OnTextChanged="txtSKU1_TextChanged" AutoPostBack="true"
Upvotes: 2