Denver Denver - 22 days ago 5
ASP.NET (C#) Question

Textchange Event not firing in update panel with ToolkitScriptManager using asp.net

here is my aspx code


<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"> </asp:ToolkitScriptManager>



<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:TextBox ID="txt_newPayment" runat="server" Style="text-align: center" onblur="if(this.value=='')this.value=this.defaultValue;" value="0" onfocus="if(this.value==this.defaultValue)this.value='';" class="form-control"
Font-Bold="True" Font-Size="XX-Large" Height="50px" ontextchanged="txt_newPayment_TextChanged">0</asp:TextBox>
<asp:Label ID="Label5" runat="server" Text="Change: " Style="text-align: center;
font-size: 20px; color: black" Font-Bold="True"></asp:Label>
<asp:Label ID="lblChange" runat="server" Text="N/A" Style="text-align: center; font-size: 20px; color: green" Font-Bold="True"></asp:Label>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="txt_newPayment" EventName ="TextChanged"/>
</Triggers>
</asp:UpdatePanel>


the very problem is this code is not firing the textchange event in my c#

protected void txt_newPayment_TextChanged(object sender, EventArgs e)
{

}

Answer

It seems that, your code looks good and all the required tags were placed for update panel issue, but one small problem AutoPostBack="True" was missed in the above Textbox control. Just add this attributes to the textbox control it will surely trigger the event.

Hope it was useful,kindly share your thoughts or feedbacks

thanks karthik

Comments