Click here to Skip to main content
16,020,626 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

I have written TextChanged event and Button Click. First TextChanged event fired. when i click button TextChanged event fired first and button click event get executed whats the problem??



<asp:TextBox ID="txtPoNo" runat="server" AutoPostBack="True" OnTextChanged="txtPoNo_TextChanged"></asp:TextBox>

<pre><asp:Button ID="btnSave" runat="server" Text="Save"
                            OnClick="btnSave_Click" />
Posted
Comments
Vijay Kr Sharma 31-Dec-11 7:23am    
This may be the problem of page postback write your txtPoNo_TextChanged code to avoid postback

1 solution

It's not a problem, it's by design[^].

The server side representation of the controls gets updated, causing the OnTextChanged to be fired, before the OnClick and similar event handlers are invoked.

Best regards
Espen Harlinn
 
Share this answer
 
Comments
Wendelius 31-Dec-11 7:27am    
Nothing to add, 5 :)
Espen Harlinn 31-Dec-11 7:28am    
Thank you, Mika!
thatraja 31-Dec-11 8:43am    
Yep, 5!
Espen Harlinn 31-Dec-11 8:43am    
Thank you, thatraja!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900