User-271186128 posted
Hi tharakab,
As far as we all known, the TextChanged event doesn't fire until you tab out of the textbox (or click somewhere else on the page). From your description, we can know that after the first number input, it will trigger the textChange event. I suppose it is
related to the QR code reader.
I suggest you could add a conditional statement in the TextChanged event. Like this.
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" EnablePageMethods="true" runat="server"></asp:ToolkitScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:TextBox ID="TextBox1" AutoPostBack="true" OnTextChanged="TextBox1_TextChanged" runat="server"></asp:TextBox>
<br />
<asp:Label ID="Label2" runat="server" Text=""></asp:Label>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="TextBox1" EventName="TextChanged" />
</Triggers>
</asp:UpdatePanel>
Code Behind:
protected void TextBox1_TextChanged(object sender, EventArgs e)
{
//Check the textBox value length.
if(TextBox1.Text.Length>3)
{
Label2.Text = TextBox1.Text;
}
}
Besides, you could also try to add a button into updatepanel, and use it to get the textbox value.
Best Regards,
Dillion